Python tkinter 编程之Button_1

# -*-coding:utf-8 -*-
#
'''
第一个Button例子
Button功能触发事件
command:指定事件处理函数
'''
from tkinter import *
def hellowButton():
    print('hello Button')
root = Tk()
Button(root, text = 'Hello Button',
       command = hellowButton).pack()
#下面的relief = FLAT设置,不指定事件处理函数,就是一个Label了!!!
Button(root, text = 'hello button', relief = FLAT).pack()
root.mainloop()
发布了33 篇原创文章 · 获赞 5 · 访问量 1万+

猜你喜欢

转载自blog.csdn.net/qiukapi/article/details/104032568