Skip to content

Commit

Permalink
Make Connected/Disconnected label background colored
Browse files Browse the repository at this point in the history
Closes #17
  • Loading branch information
qwertychouskie committed May 9, 2024
1 parent 2cac6db commit 577feee
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions REVHubInterface/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -517,8 +517,6 @@ def __init__(self, root):
true = True
self.Main_window = tkinter.ttk.Frame(root)
style = tkinter.ttk.Style()
style.configure("Red.Label", foreground="red")
style.configure("Green.Label", foreground="green")
style.configure("Quit.TButton", foreground='red')
self.Tab_frame = tkinter.ttk.Notebook(self.Main_window)
self.Connected_Label = tkinter.ttk.Label(self.Main_window)
Expand Down Expand Up @@ -553,7 +551,7 @@ def __init__(self, root):
self.Tab_frame.grid(column=0, columnspan=3, padx=5, pady=5, row=1, sticky=(N, S, E, W))

self.Connected_Label.grid(row=0, sticky=E)
self.Connected_Label.config(text='Disconnected', style='Red.Label')
self.Connected_Label.config(text=' Disconnected ', background='red', foreground='white')

self.Top_Banner.grid(row=0, sticky=W)

Expand Down Expand Up @@ -619,9 +617,9 @@ def send_all_KA(self):
isAlive = module.sendKA()
if isAlive == False:
self.on_quit_button_callback()
self.Connected_Label.config(text='Disconnected', style='Red.Label')
self.Connected_Label.config(text=' Disconnected ', background='red', foreground='white')
else:
self.Connected_Label.config(text='Connected', style='Green.Label')
self.Connected_Label.config(text=' Connected ', background='green', foreground='white')
module.getStatus()

def speedMotorSlider(self, speed, moduleNumber, motorNumber, *args):
Expand Down Expand Up @@ -989,7 +987,7 @@ def on_quit_button_callback(self):
self.repetitiveFunctions = []
self.commMod.closeActivePort()
self.Quit_button.config(state='disabled')
self.Connected_Label.config(text='Disconnected', style='Red.Label')
self.Connected_Label.config(text=' Disconnected ', background='red', foreground='white')
for i in range(0, len(self.Tab_frame.tabs())):
if i < 4:
self.Tab_frame.tab(i, state='disabled')
Expand Down

0 comments on commit 577feee

Please sign in to comment.