On 05-05-10 19:54, Felipe Tortella wrote:
> Hi, I wanted to help solve a problem with buttons.
>
> I am creating a game, and I'm setting a button "b1" with the label
> "0". Wanted when this button was clicked, the label was changed in the
> window to "1".
def button_pressed(widget):
if widget.get_label() == "0":
widget.set_label("1")
else:
widget.set_label("0")
Or does it need to be increased every time?
def button_pressed(widget):
new_val = int(widget.get_label()) + 1
widget.set_label(str(new_val))
Cheers,
Timo
>
> Can anyone help me?
>
>
> _______________________________________________
> pygtk mailing list [email protected]
> http://www.daa.com.au/mailman/listinfo/pygtk
> Read the PyGTK FAQ: http://faq.pygtk.org/
_______________________________________________
pygtk mailing list [email protected]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/