2017-06-14 53 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() 
相关问题