Ui for controlling timer implimented

This commit is contained in:
Brightbites
2026-02-05 14:23:01 +00:00
parent eb884f5c12
commit bb065b551d

View File

@@ -3,25 +3,37 @@ import dearpygui.dearpygui as dpg
dpg.create_context() dpg.create_context()
dpg.create_viewport(title='RocketLaunchCountdown', width=600, height=400) dpg.create_viewport(title='RocketLaunchCountdown', width=600, height=400)
TLToggle = False
def start(): def start():
print("Start pressed") print("Start pressed")
if TLToggle:
dpg.set_value("text item", "00:00:00")
else: dpg.set_value("text item", "00:00:01")
def hold(): def hold():
print("Hold pressed") print("Hold pressed")
def scrub(): def scrub():
print("Scrub pressed") print("Scrub pressed")
dpg.set_value("text item", "SCRUB")
def Ttoggle():
global TLToggle
if TLToggle:
TLToggle = False
else: TLToggle = True
print(TLToggle)
with dpg.window(tag="Primary Window"): with dpg.window(tag="Primary Window"):
dpg.add_text("T- " + "00:00:00") dpg.add_text("T- 00:00:00", tag="text item")
dpg.add_separator() dpg.add_separator()
with dpg.group(horizontal=True): with dpg.group(horizontal=True):
dpg.add_button(label="Start", callback=start) dpg.add_button(label="Start", callback=start)
dpg.add_button(label="Hold", callback=hold) dpg.add_button(label="Hold", callback=hold)
dpg.add_button(label="Scrub", callback=scrub) dpg.add_button(label="Scrub", callback=scrub)
with dpg.group() as group1: dpg.add_button(label="Toggle T- L-", callback=Ttoggle)
pass
dpg.show_metrics() dpg.show_metrics()
dpg.show_style_editor() dpg.show_style_editor()