There is a drag behavior in behaviors, or you can create your own drag and drop behavior using the on_touch_ methods.
I started to experiment with drag behaviors: https://github.com/ElliotGarbus/KivyDragExperiments
But I have never built an app using drag behavior. I have previously just created my own.
--
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/e48a736c-7eeb-4d47-966a-454dfe740dd8n%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/353f2cc5-2def-44e7-9745-6eb37233e368n%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/60a131fa.1c69fb81.37529.1b72SMTPIN_ADDED_MISSING%40gmr-mx.google.com.
How you access one class instance from another is a function of where each instance sits in the kivy tree relative to each other.
Screens make this even a little more complicated. Lets assume the following:
BoxLayout: # root widget
…
ScreenManager:
id: sm
ScreenOne:
name: ‘one’
ScreenTwo:
name: ‘two’
<ScreenOne>:
BoxLayout:
…
ClassOne:
id:s1c1
Button:
text: ‘print a property from the Class2 instance from screen two’
on_release: print(app.root.ids.sm.get_screen(‘two’).ids.s2c2.prop)
<ScreenTwo>:
BoxLayout:
…
ClassTwo:
id: s2c2
prop: ‘The value’
Lets say we want to access a property in the ClassTwo instance from ScreenOne… see the on_release statement in ScreenOne Button.
Looking at the ‘kivy string’
app – The app instance
app.root- The root widget
app.root.ids – All the id’s of the root
app.root.ids.sm – The screenmanager
app.root.ids.sm.get_screen(‘two) – The ScreenTwo instance
app.root.ids.sm.get_screen(‘two’).ids – all the id’s of ScreenTwo
app.root.ids.sm.get_screen(‘two’).ids.s2c2 – The ClassTwo instance in ScreenTwo
app.root.ids.sm.get_screen(‘two’).ids.s2c2.prop – The property (‘The Value’).
You can print these out to see them.
How you actually access items across the kivy tree is dependent on how you have constructed the tree.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/CALgom8pM_qWpJpDQS_G0uZ8KRaW67RCqdEcGFFNX_h7%3DobRyVA%40mail.gmail.com.
Ooops… While the code below will work, because these are Screens you can use their manager property to simplify:
You can change:
app.root.ids.sm.get_screen(‘two’).ids.s2c2.prop
to:
self.manager.get_screen(‘two’).ids.s2c2.prop
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/CALgom8pM_qWpJpDQS_G0uZ8KRaW67RCqdEcGFFNX_h7%3DobRyVA%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/60a1d12f.1c69fb81.229e2.6254SMTPIN_ADDED_MISSING%40gmr-mx.google.com.
There is a problem that you have the id’s in your screens as strings. They need to be identifiers.
<ScreenContagem>
name: 'tela_contagem'
id: tela_contagem # 'tela_contagem'
Additionally,
The get_screen() returns the screen widget, using the ids to get the screen is redundant. You do not need the id.
app.root.ids.screen_manager.get_screen ('tela_contagem').remove_item (root)
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/CALgom8oX_tjnbP0JZwatbYPEswbeLqXMOtiESdnoYkO%3De9A2qQ%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/60a27a3c.1c69fb81.70d03.e477SMTPIN_ADDED_MISSING%40gmr-mx.google.com.
Feel free to ask.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/CALgom8o4k%3Ds5mM49xE6tNLwV%3Db-W5%3DhjwKF7A6M0nCwgaExMFQ%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/60a2aa14.1c69fb81.49f85.6e61SMTPIN_ADDED_MISSING%40gmr-mx.google.com.
I help for the pleasure of helping. As a grateful user of an open-source project my contributions here are part of how I give back, and help support the community.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/CALgom8oqqx9DVSYYEiQ-huZXd4XuAO3YjV65y9_Be0rXqADxog%40mail.gmail.com.