Кнопка Python Tkinter с операторами If ElsePython

Программы на Python
Anonymous
Кнопка Python Tkinter с операторами If Else

Сообщение Anonymous »

Я хочу связать Start_Button с двумя возможными функциями:

Если нажата Choice_1_Button, а затем Start_Button, Start_Button должна вызвать foo1. Но когда пользователь нажимает Choice_2_Button, та же кнопка «Пуск» должна вызвать foo2.

Вот код, который у меня сейчас есть:

Код: Выделить всё

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?
Кто-нибудь знает, что должно делать Something, Something_else и if-something?

Вернуться в «Python»