Python Forum
2 buttons to run 2 different functions?
Thread Rating:
  • 1 Vote(s) - 2 Average
  • 1
  • 2
  • 3
  • 4
  • 5
2 buttons to run 2 different functions?
#2
I think I figured it out. Will post here for anybody else who may stumble upon this.

The way to get the two buttons to do 2 different function calls is to read the text of those buttons - in my case, they are Check DB for SUID, Submit, and Cancel.

while True:      
        # Read the Window    
    event, value = window.Read()      
        # Take appropriate action based on button      
    if event == 'Check DB for SUID':      
          checkdb()      
    elif event == 'Submit':      
          updatedb()      
    elif event =='Cancel'  or event is None:  
          window.Close()    
          break   
Reply


Messages In This Thread
RE: 2 buttons to run 2 different functions? - by JP_ROMANO - Jan-08-2019, 10:15 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  [Tkinter] how to add two buttons with different functions in Tk LinuxLife 8 4,345 Mar-28-2022, 04:59 PM
Last Post: Barrowman

Forum Jump:

User Panel Messages

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