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 ;)

So, how did you solve the problem?

BTW, I really enjoyed reading your blogs!

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.