Python tkinter 编程之Button_1

落花浮王杯 提交于 2020-01-24 05:45:40
# -*-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()

 

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!