Is it possible to combine the code of Kivy and KivyMD?

47 views
Skip to first unread message

Драбышевский Никита

unread,
Mar 30, 2020, 4:34:37 PM3/30/20
to Kivy users support
For example can i use DragBehavior from kivy inside KivyMd BoxLayout?

Elliot Garbus

unread,
Mar 30, 2020, 6:18:32 PM3/30/20
to kivy-...@googlegroups.com

Here is a short example, using just kivy:

 

from kivy.app import App
from kivy.lang import Builder


kv =
'''
<DragLabel@DragBehavior+Label>:
    # Define the properties for the DragLabel
    drag_rectangle: self.x, self.y, self.width, self.height
    drag_timeout: 10000000
    drag_distance: 0

GridLayout:
    cols:2
    rows:2
    DragLabel:
        size_hint: 0.25, 0.2
        text: 'Drag me'
    DragLabel:
        size_hint: 0.25, 0.2
        text: 'Drag me'
    DragLabel:
        size_hint:  0.25, 0.2
        text: 'Drag me'
    DragLabel:
        size_hint: 0.25, 0.2
        text: 'Drag me'
   
'''


class DragTestApp(App):
   
def build(self):
       
return Builder.load_string(kv)


DragTestApp().run()

--
You received this message because you are subscribed to the Google Groups "Kivy users support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kivy-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/1995ad47-1070-46a8-ba73-7a8a0d76c2d9%40googlegroups.com.

 

Reply all
Reply to author
Forward
0 new messages