当前位置: 代码迷 >> 综合 >> Python tkinter 编程之Button_1
  详细解决方案

Python tkinter 编程之Button_1

热度:21   发布时间:2024-01-25 22:44:16.0
# -*-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()

 

  相关解决方案