2017-06-14 38 views
-6

如何創建一個可以激活程序的按鈕?有點像電子遊戲。 如果你想解決這個問題,請將這些請求付諸行動。 1.它需要在Python 3 2.it需要相當簡單。如何讓一個按鈕在Python上按下3

感謝

+0

你應該提供一個例子,如果你期望別人回答。 – suvy

+2

請先求助,然後再請求幫助。 – SH7890

回答

3

我不知道你通過激活程序的意思,但在例如下面通過「命令= Funtcion_name」你可以得到你想要通過點擊按鈕什麼

from tkinter import * 
from tkinter import messagebox 

def pushTheButton(): 
    messagebox.showinfo("Outcome of pushing the button", " You have pushed the button!") 

root = Tk() 

button = Button(root, text = "Push me", command = pushTheButton) 
button.pack() 

root.mainloop() 
相關問題