-
Notifications
You must be signed in to change notification settings - Fork 11
/
frame_statusbar.py
50 lines (39 loc) · 1.32 KB
/
frame_statusbar.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
41
42
43
44
45
46
47
48
49
50
import tkinter as tk
from tkinter import ttk
class frame_statusbar:
def __init__(self, parent):
self._parent = parent
self._frame = tk.Frame(parent)
self.init_progress_bar()
self.progress_bar_set_value(0)
self.init_label()
self.label_hidden()
def frame(self):
return self._frame
def label_hidden(self):
self.label.place_forget()
def label_show(self):
self.label.place(relwidth=1, relheight=1)
def init_label(self):
self.label = tk.Label(self._frame, text="")
self.status_label_set_bg("SystemButtonFace")
def status_label_set_text(self, text, color):
self.label["text"] = text
self.status_label_set_bg(color)
self.label_show()
def status_label_set_bg(self, color):
self.label["bg"] = color
'''
if color == 1: # system
self.label["bg"] = "SystemButtonFace"
elif color == 2: # red
self.label["bg"] = "red"
else: # green
self.label["bg"] = "#06b025"
'''
def init_progress_bar(self):
self.bar = ttk.Progressbar(
self._frame, orient="horizontal", mode="determinate")
self.bar.pack(fill="both", expand=True)
def progress_bar_set_value(self, value):
self.bar["value"] = value