I'm making a little game and I can't get button bindings to work. Here is what I have so far

def forward(event):
    print "up"

frame.bind("<Up>",forward)

but pressing the up arrow does nothing...is there something I missed?

What GUI toolkit are you using and what type of object is "frame"?

Maybe you are defining function in class and forgot to include self parameter, works, when I added it in init of my tkinter program

main.bind("<Up>", self.forward)

and the def into the class.

Also to my Photoimage post it worked, but must bind to master, not frame

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.