Skip to content Skip to sidebar Skip to footer

Binding Not Working Tkinter Python3

so I'm working on a rubics cube timer in python 3 (using tkinter). I am trying to make it so that when you press space, the timer stops (originally i tried to do this for starting

Solution 1:

You are very close.

First, the bind function needs the function itself as an argument. Since you have the () on the end, you are passing the result of running the function, in this case None. Just leave those off:

root.bind("<space>",sw.Stop)

Second, the function that bind calls must accept an event argument. So you need to define it like this:

defStop(self, event=None):

Post a Comment for "Binding Not Working Tkinter Python3"