Python Forum
[Tkinter] how to add two buttons with different functions in Tk
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Tkinter] how to add two buttons with different functions in Tk
#2
You are reusing variable names.
textbox2 is an entry in line 22 and a different entry in line 68. Line 68 executes last, so textbox2 is the second entry. When btn2_click executes, it gets text from the second entry, not the first. I also don't see any code that places the first textbox2.

There can be only one mainloop() in your program. After you make everything you call mainloop(). mainloop() will block the program until the root window is closed.
Reply


Messages In This Thread
RE: how to add two buttons with different functions in Tk - by deanhystad - Mar-26-2022, 04:28 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  2 buttons to run 2 different functions? JP_ROMANO 2 4,279 Jan-10-2019, 02:25 PM
Last Post: JP_ROMANO

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020