I have a kv segment that is within my python code.
What I want to do is select this button and animate it. The animation itself is triggered by pressing NoButton
. NoButton
has a class of itself that is child to the root widget class. Unfortunately despite having been able to successfully reference id out of the kv code, i can't seem actually make use of it.
Pressing NoButton
results in absolutely nothing. No errors, nothing. If I try to print the id what i get is the location of the button it references:
<__main__.MainButton object at 0x7fd5db0d5590>
Here is a snippet of the kv code:
<MainClass>:
<MainScreen>:
id: main
AnchorLayout:
size: root.size
anchor_x: 'center'
anchor_y: 'center'
padding: 0, 0, 0, 50
MainButton:
id: pics
rgba: 1,5,1,1
size_hint_x: None
size_hint_y: None
height: main.height / 1.5
width: main.width / 1.5
and the python:
class MainScreen(Screen):
pass
class MainButton(Button):
pass
class NoButton(ButtonBehavior, Image, MainClass):
def on_press(self):
anim = Animation(x=300, y=300)
anim.start(MainButton())
print(MainScreen().ids.pics)
You'll notice anim.start
references the class rather than the id here. Unfortunately it produces the same result; nothing at all.
Creating pics
as an object property and declaring that in kv fails to work too.
I really am completely clueless here. I've looked through the few questions that are slightly similar but there really isn't much when it comes to help/guides for in depth kivy development.
I'm using Python 3.5.3 and Kivy 1.9.2-dev0
Would appreciate any help/advice or pointers in the right direction :)