watch as i make this input disapear
This commit is contained in:
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
__pycache__
|
||||
42
GUI.py
42
GUI.py
@@ -2,7 +2,25 @@ import dearpygui.dearpygui as dpg
|
||||
import backend
|
||||
import time
|
||||
|
||||
if __name__ == '__main__':
|
||||
def toggleDate():
|
||||
global dateInputVisable
|
||||
if dateInputVisable:
|
||||
dateInputVisable = False
|
||||
dpg.configure_item("Day", show=False, enabled=False)
|
||||
dpg.configure_item("Month", show=False, enabled=False)
|
||||
dpg.configure_item("Year", show=False, enabled=False)
|
||||
dpg.configure_item("dayTooltip", show=False)
|
||||
dpg.configure_item("monthTooltip", show=False)
|
||||
dpg.configure_item("yearTooltip", show=False)
|
||||
else:
|
||||
dateInputVisable = True
|
||||
dpg.configure_item("Day", show=True, enabled=True)
|
||||
dpg.configure_item("Month", show=True, enabled=True)
|
||||
dpg.configure_item("Year", show=True, enabled=True)
|
||||
dpg.configure_item("dayTooltip", show=True)
|
||||
dpg.configure_item("monthTooltip", show=True)
|
||||
dpg.configure_item("yearTooltip", show=True)
|
||||
|
||||
dpg.create_context()
|
||||
dpg.create_viewport(title='RocketLaunchCountdown', min_width=600, min_height=400, width=600, height=400)
|
||||
|
||||
@@ -23,7 +41,7 @@ if __name__ == '__main__':
|
||||
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")
|
||||
dpg.add_button(label="Toggle Date Till", tag="toggleDate", callback="toggledateview")
|
||||
dpg.add_button(label="Toggle Date Till", tag="toggleDate", callback=toggleDate)
|
||||
with dpg.group(horizontal=True):
|
||||
dpg.add_input_int(min_value=1, max_value=31, min_clamped=True, max_clamped=True, step=0, tag="Day")
|
||||
dpg.add_input_int(min_value=1, max_value=12, min_clamped=True, max_clamped=True, step=0, tag="Month")
|
||||
@@ -38,13 +56,13 @@ if __name__ == '__main__':
|
||||
with dpg.tooltip("Seconds"):
|
||||
dpg.add_text("Seconds")
|
||||
|
||||
with dpg.tooltip("Day"):
|
||||
with dpg.tooltip("Day", tag="dayTooltip"):
|
||||
dpg.add_text("Day")
|
||||
|
||||
with dpg.tooltip("Month"):
|
||||
with dpg.tooltip("Month", tag="monthTooltip"):
|
||||
dpg.add_text("Month")
|
||||
|
||||
with dpg.tooltip("Year"):
|
||||
with dpg.tooltip("Year", tag="yearTooltip"):
|
||||
dpg.add_text("Year")
|
||||
|
||||
dpg.bind_font(second_font)
|
||||
@@ -58,8 +76,10 @@ if __name__ == '__main__':
|
||||
|
||||
currentViewportSize = 0
|
||||
seccondPassed = 0
|
||||
dateInputVisable = True
|
||||
|
||||
while dpg.is_dearpygui_running(): # on every frame
|
||||
|
||||
if not dpg.get_viewport_client_width() == currentViewportSize: # has it been resized
|
||||
currentViewportSize = dpg.get_viewport_client_width()
|
||||
dpg.configure_item("text item", width=int(currentViewportSize - 16))
|
||||
@@ -90,15 +110,3 @@ if __name__ == '__main__':
|
||||
dpg.render_dearpygui_frame()
|
||||
|
||||
dpg.destroy_context()
|
||||
|
||||
def toggledateview(sender, app_data):
|
||||
if dateInputVisable:
|
||||
dateInputVisable = False
|
||||
dpg.configure_item("Day", enabled=False)
|
||||
dpg.configure_item("Month", enabled=False)
|
||||
dpg.configure_item("Year", enabled=False)
|
||||
else:
|
||||
dateInputVisable = True
|
||||
dpg.configure_item("Day", enabled=True)
|
||||
dpg.configure_item("Month", enabled=True)
|
||||
dpg.configure_item("Year", enabled=True)
|
||||
|
||||
Reference in New Issue
Block a user