import sys
from tkinter import *
credit = 0
coins = 0
choice = 0
credit1 = 0
coins = 0
prices = [200,150,160,50,90]
item = 0
i = 0
temp=0
n=0
choice1 = 0
choice2 = 0
credit1 = 0
coins = 0
prices = [200,150,160,50,90]
item = 0
i = 0
temp=0
n=0
choice1 = 0
choice2 = 0
def insert():
insert = Tk()
insert.geometry("450x250")
iLabel = Label(insert, text="Enter coins.[Press Buttons]").grid(row=1, column=1)
tenbutton = Button(insert, text="10p").grid(row=2, column=1)
twentybutton = Button(insert, text="20p").grid(row=3, column=1)
fiftybutton = Button(insert, text="50p").grid(row=4, column=1)
poundbutton = Button(insert, text="£1").grid(row=5, column=1)
我创建模拟自动售货机的程序。 我如何告诉Python'检查'A按钮是否被按下? 伪代码将是:
if tenbutton is pressed:
Add 10p to credit
我怎么会用Python语言编写“如果按下tenbutton”?先谢谢你。
哈哈我们必须google搜索同样的东西,并得到相同的结果:) – Dunno
我每天都在使用Tkinter。不需要谷歌;) – atlasologist