Simply, I need to understand the basics of button binding. I have researched this already and have decided just to ask for instruction.

For example, one of the programs I am building currently will require, at a certain point, user input; I want to be able to know when a button has been pushed. I think I will have to use "<Button-1>" but I am not entirely sure of the rest of the necessary code needed to do so. I do not quite understand the syntax. What I have tried thus far has not worked.

The following is a snip of a button code (no use of binding) from the current Py project:

btn1 = Button(root ,bg="Black", text="HIT",    image=image01,command=show_image2)
btn1.configure(state=NORMAL,background='red' )
btn1.pack()

Any help would be greatly appreciated as it would put me close to finishing my build.

Thank-you.

sharky_machine

Simply, I need to understand the basics of button binding. I have researched this already and have decided just to ask for instruction.

For example, one of the programs I am building currently will require, at a certain point, user input; I want to be able to know when a button has been pushed. I think I will have to use "<Button-1>" but I am not entirely sure of the rest of the necessary code needed to do so. I do not quite understand the syntax. What I have tried thus far has not worked.

The following is a snip of a button code (no use of binding) from the current Py project:

btn1 = Button(root ,bg="Black", text="HIT",    image=image01,command=show_image2)
btn1.configure(state=NORMAL,background='red' )
btn1.pack()

Any help would be greatly appreciated as it would put me close to finishing my build.

Thank-you.

sharky_machine

I figured it out ;)

This question has already been answered. Start a new discussion instead.