-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path9_progressbar.py
More file actions
35 lines (26 loc) · 859 Bytes
/
9_progressbar.py
File metadata and controls
35 lines (26 loc) · 859 Bytes
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
from tkinter import *
import tkinter.ttk as ttk
import time
root = Tk()
root.title("Nado GUI")
root.geometry("640x480")
# #progressbar = ttk.Progressbar(root, maximum=100, mode="indeterminate")
# progressbar = ttk.Progressbar(root, maximum=100, mode="determinate")
# progressbar.start(10) # 10 ms 마다 움직임
# progressbar.pack()
# def btncmd():
# progressbar.stop() # 작동 중지
# btn = Button(root, text="중지", command=btncmd)
# btn.pack()
p_var2 = DoubleVar()
progressbar2 = ttk.Progressbar(root, maximum=100, length=150, variable=p_var2)
progressbar2.pack()
def btncmd2():
for i in range(1, 101):
time.sleep(0.01) # 0.01 초 대기
p_var2.set(i) # progress bar 의 값 설정
progressbar2.update()
print(p_var2.get())
btn = Button(root, text="시작", command=btncmd2)
btn.pack()
root.mainloop()