Python GUI编程(Tkinter)3、Button控件


import tkinter

def func():
print("sunck is a good man")

win = tkinter.Tk()
win.title("sunck")
win.geometry("400x400+200+20")

#创建按钮
button1 = tkinter.Button(win, text="按钮", command=func, width=10, height=10)
button1.pack()

button2 = tkinter.Button(win, text="按钮", command=win.quit)
button2.pack()

win.mainloop()


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM