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