Bohr
Bohr

Reputation: 103

ToggleButton on_state programmatically?

I'm making ToggleButtons programmatically and I want to set the on_state method, but it doesn't seem to work:

 tbutton = uix.togglebutton.ToggleButton(multiline=True,markup=True,text=text,group="g",size_hint=(1,None))
 tbutton.bind(on_state=self.my_function)
 def my_function(self,*args):
     print "TEST"

If I press the button nothing seems to work.

Upvotes: 2

Views: 874

Answers (1)

Yoav Glazner
Yoav Glazner

Reputation: 8066

You should bind state - not on_state ...

tbutton.bind(state=self.my_function)

That it :)

Upvotes: 2

Related Questions