-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest1.py
40 lines (33 loc) · 1.16 KB
/
test1.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
33
34
35
36
37
38
39
40
# coding:utf-8
from tkinter import *
# from ScrolledText import ScrolledText # 文本滚动条
import threading
import time
from tkinter.scrolledtext import ScrolledText
from PIL import ImageTk, Image
def count(i):
for k in range(1, 100 + 1):
text.insert(END, '第' + str(i) + '线程count: ' + str(k) + '\n')
time.sleep(0.001)
def fun():
for i in range(1, 5 + 1):
th = threading.Thread(target=count, args=(i,))
th.setDaemon(True) # 守护线程
th.start()
var.set('MDZZ')
root = Tk()
root.title('九日王朝') # 窗口标题
root.geometry('+600+100') # 窗口呈现位置
# image2 = Image.open(r'ParticleSmoke.png')
# background_image = ImageTk.PhotoImage(image2)
textlabel = Label(root)
textlabel.grid()
text = ScrolledText(root, font=('微软雅黑', 10), fg='blue')
text.grid()
button = Button(root, text='屠龙宝刀 点击就送', font=('微软雅黑', 10), command=fun)
button.grid()
var = StringVar() # 设置变量
label = Label(root, font=('微软雅黑', 10), fg='red', textvariable=var)
label.grid()
var.set('我不断的洗澡,油腻的师姐在哪里')
root.mainloop()