# -*-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()
本文介绍使用Python的Tkinter库创建GUI按钮的基本方法。通过实例演示如何使用Button控件,并触发事件处理函数。同时,展示了如何通过改变relief属性将按钮转换为静态标签。
547

被折叠的 条评论
为什么被折叠?



