[Python] Python Tkinter Button with If Else statements

Discussão em 'Python' iniciado por Stack, Abril 15, 2025.

  1. Stack

    Stack Membro Participativo

    I want to bind the Start_Button with 2 possible functions:

    If Choice_1_Button is clicked and then the Start_Button, the Start_Button should call foo1. But when the user clicks Choice_2_Button then the same Start Button should call foo2.

    Here is the code I currently have:

    from tkinter import *
    root=Tk()
    Choice_1_Button=Button(root, text='Choice 1', command=something) #what should it do?
    Choice_2_Button=Button(root, text='Choice 2', command=something_else)
    Start_Button=Button(root, text='Start', command=if_something) #and what about this?


    Does anyone know what something, something_else and if-something should do?

    Continue reading...

Compartilhe esta Página