-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathui-类函数.py
32 lines (27 loc) · 873 Bytes
/
ui-类函数.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
'''
Author: 木白广木林
Date: 2023-12-11 15:36:23
LastEditors: Do not edit
LastEditTime: 2023-12-11 15:36:29
FilePath: \py\ui-类函数.py
'''
import tkinter as tk
class Application(tk.Frame):
def __init__(self, master=None):
super().__init__(master)
self.master = master
self.pack()
self.create_widgets()
def create_widgets(self):
self.hi_there = tk.Button(self)
self.hi_there["text"] = "Hello World\n(click me)"
self.hi_there["command"] = self.say_hi
self.hi_there.pack(side="top")
self.quit = tk.Button(self, text="QUIT", fg="red",
command=self.master.destroy)
self.quit.pack(side="bottom")
def say_hi(self):
print("hi there, everyone!")
root = tk.Tk()
app = Application(master=root)
app.mainloop()