make resize buttons only when viewport is resized
This commit is contained in:
35
GUI.py
35
GUI.py
@@ -1,15 +1,17 @@
|
||||
import dearpygui.dearpygui as dpg
|
||||
import backend
|
||||
|
||||
dpg.create_context()
|
||||
dpg.create_viewport(title='RocketLaunchCountdown', min_width=600, min_height=400, width=600, height=400)
|
||||
def GUI():
|
||||
dpg.create_context()
|
||||
dpg.create_viewport(title='RocketLaunchCountdown', min_width=600, min_height=400, width=600, height=400)
|
||||
|
||||
with dpg.font_registry():
|
||||
with dpg.font_registry():
|
||||
# first argument ids the path to the .ttf or .otf file
|
||||
default_font = dpg.add_font("OpenSans-Medium.ttf", 128)
|
||||
second_font = dpg.add_font("OpenSans-Medium.ttf", 36)
|
||||
|
||||
|
||||
with dpg.window(tag="Primary Window"):
|
||||
with dpg.window(tag="Primary Window"):
|
||||
BIG = dpg.add_button(label="T- 00:00:00", tag="text item")
|
||||
dpg.add_separator()
|
||||
with dpg.group(horizontal=True):
|
||||
@@ -18,7 +20,6 @@ with dpg.window(tag="Primary Window"):
|
||||
dpg.add_button(label="Scrub", tag="Scrub")
|
||||
dpg.add_button(label="Toggle T- L-", tag="toggle")
|
||||
with dpg.group(horizontal=True):
|
||||
|
||||
dpg.add_input_int(min_value=0, max_value=23, min_clamped=True, max_clamped=True, step=0, tag="Hours")
|
||||
dpg.add_input_int(min_value=0, max_value=59, min_clamped=True, max_clamped=True, step=0, tag="Minutes")
|
||||
dpg.add_input_int(min_value=0, max_value=59, min_clamped=True, max_clamped=True, step=0, tag="Seconds")
|
||||
@@ -49,13 +50,16 @@ with dpg.window(tag="Primary Window"):
|
||||
dpg.bind_font(second_font)
|
||||
dpg.bind_item_font(BIG, default_font)
|
||||
|
||||
dpg.show_style_editor()
|
||||
dpg.show_style_editor()
|
||||
|
||||
dpg.setup_dearpygui()
|
||||
dpg.show_viewport()
|
||||
dpg.set_primary_window("Primary Window", True)
|
||||
dpg.setup_dearpygui()
|
||||
dpg.show_viewport()
|
||||
dpg.set_primary_window("Primary Window", True)
|
||||
|
||||
while dpg.is_dearpygui_running():
|
||||
currentViewportSize = 0
|
||||
|
||||
while dpg.is_dearpygui_running():
|
||||
if not dpg.get_viewport_client_width() == currentViewportSize:
|
||||
dpg.configure_item("text item", width=int(dpg.get_viewport_width() - 16))
|
||||
dpg.configure_item("Start", width=int((dpg.get_viewport_client_width() / 4) - 10))
|
||||
dpg.configure_item("Hold", width=int((dpg.get_viewport_client_width() / 4) - 10))
|
||||
@@ -68,6 +72,15 @@ while dpg.is_dearpygui_running():
|
||||
dpg.configure_item("Minutes", width=int((dpg.get_viewport_client_width() / 4) - 10))
|
||||
dpg.configure_item("Seconds", width=int((dpg.get_viewport_client_width() / 4) - 10))
|
||||
dpg.configure_item("toggleDate",width=int((dpg.get_viewport_client_width() / 4) - 10))
|
||||
currentViewportSize = dpg.get_viewport_client_width()
|
||||
#if seccondPassed:
|
||||
# backend.countdownTime()
|
||||
# seccondPassed = False
|
||||
# timeFinished = 0
|
||||
|
||||
dpg.render_dearpygui_frame()
|
||||
|
||||
dpg.destroy_context()
|
||||
dpg.destroy_context()
|
||||
|
||||
if __name__ == '__main__':
|
||||
GUI()
|
||||
19
_main.py
19
_main.py
@@ -1,19 +0,0 @@
|
||||
from Rewrite import *
|
||||
import time
|
||||
|
||||
print(fetchGonogo())
|
||||
print(fetchMajorConcerns())
|
||||
|
||||
structTime = time.strptime("1 1 1970 0 0 10", "%d %m %Y %H %M %S")
|
||||
isDate = False
|
||||
inputTime = convertEpoch(structTime, isDate)
|
||||
|
||||
onHold = False
|
||||
for returned in countdownTime(inputTime, onHold):
|
||||
print(returned)
|
||||
|
||||
# Time Tell launch
|
||||
# input in
|
||||
|
||||
# Date Time
|
||||
#current time - epoch
|
||||
Reference in New Issue
Block a user