make resize buttons only when viewport is resized
This commit is contained in:
15
GUI.py
15
GUI.py
@@ -1,5 +1,7 @@
|
|||||||
import dearpygui.dearpygui as dpg
|
import dearpygui.dearpygui as dpg
|
||||||
|
import backend
|
||||||
|
|
||||||
|
def GUI():
|
||||||
dpg.create_context()
|
dpg.create_context()
|
||||||
dpg.create_viewport(title='RocketLaunchCountdown', min_width=600, min_height=400, width=600, height=400)
|
dpg.create_viewport(title='RocketLaunchCountdown', min_width=600, min_height=400, width=600, height=400)
|
||||||
|
|
||||||
@@ -18,7 +20,6 @@ with dpg.window(tag="Primary Window"):
|
|||||||
dpg.add_button(label="Scrub", tag="Scrub")
|
dpg.add_button(label="Scrub", tag="Scrub")
|
||||||
dpg.add_button(label="Toggle T- L-", tag="toggle")
|
dpg.add_button(label="Toggle T- L-", tag="toggle")
|
||||||
with dpg.group(horizontal=True):
|
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=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="Minutes")
|
||||||
dpg.add_input_int(min_value=0, max_value=59, min_clamped=True, max_clamped=True, step=0, tag="Seconds")
|
dpg.add_input_int(min_value=0, max_value=59, min_clamped=True, max_clamped=True, step=0, tag="Seconds")
|
||||||
@@ -55,7 +56,10 @@ dpg.setup_dearpygui()
|
|||||||
dpg.show_viewport()
|
dpg.show_viewport()
|
||||||
dpg.set_primary_window("Primary Window", True)
|
dpg.set_primary_window("Primary Window", True)
|
||||||
|
|
||||||
|
currentViewportSize = 0
|
||||||
|
|
||||||
while dpg.is_dearpygui_running():
|
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("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("Start", width=int((dpg.get_viewport_client_width() / 4) - 10))
|
||||||
dpg.configure_item("Hold", 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("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("Seconds", width=int((dpg.get_viewport_client_width() / 4) - 10))
|
||||||
dpg.configure_item("toggleDate",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.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