import tkinter
def processOk():
print("ok button is clicked")
def processCancel():
print("Cancel button is clicked")
def main():
#窗体的创建
tk = tkinter.Tk()
#组件创建
btnOk = tkinter.Button(tk, text = "OK",fg = "red", command = processOk)
btnCancel = tkinter.Button(tk,text = "Cancel",fg = "yellow",command = processCancel)
btnOk.pack()
btnCancel.pack()
tk.mainloop()
if __name__ == "__main__":
main()
Python 之 tkinter 按钮控件
最新推荐文章于 2023-03-08 19:23:32 发布