Window.Hide, Window.UnHide

This commit is contained in:
MikeTheWatchGuy 2019-02-12 16:09:59 -05:00
parent 74876c440d
commit 55210187e8
1 changed files with 46 additions and 17 deletions

View File

@ -35,12 +35,32 @@ def TimerStop():
g_time_delta = g_time_end - g_time_start g_time_delta = g_time_end - g_time_start
print(g_time_delta) print(g_time_delta)
###### ##### ##### # # ### # #
# # # # # # # # # ##### # ###### # # # # # # # # ###### #####
# # # # # # ## ## # # # # # # # # # # # # # #
###### # ##### # # ## # # # # ##### # #### # # # # # # ##### #####
# # # # # # ##### # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # #
# # ##### # # # # ###### ###### ##### ##### ### ## ## ###### #####
""" """
Welcome to the "core" PySimpleGUI code.... Welcome to the "core" PySimpleGUIWeb code....
This port is special.... it runs in a web browser! This special port of the PySimpleGUI SDK to the browser is made possible by the magic of Remi
It is based on the Remi GUI framework, an SDK that's been a real joy to work with
https://github.com/dddomodossola/remi
To be clear, PySimpleGUI would not be able to run in a web browser without this important GUI Framework
It may not be as widely known at tkinter or Qt, but it should be. Just as those are the best of the desktop
GUI frameworks, Remi is THE framework for doing Web Page GUIs in Python. Nothing else like it exists.
::::::::: :::::::::: ::: ::: :::::::::::
:+: :+: :+: :+:+: :+:+: :+:
+:+ +:+ +:+ +:+ +:+:+ +:+ +:+
+#++:++#: +#++:++# +#+ +:+ +#+ +#+
+#+ +#+ +#+ +#+ +#+ +#+
#+# #+# #+# #+# #+# #+#
### ### ########## ### ### ###########
""" """
@ -1057,6 +1077,8 @@ class MultilineOutput(Element):
elif value is not None and append: elif value is not None and append:
self.CurrentValue = self.CurrentValue + '\n' + str(value) self.CurrentValue = self.CurrentValue + '\n' + str(value)
self.Widget.set_value(self.CurrentValue) self.Widget.set_value(self.CurrentValue)
app = self.ParentForm.App
app.execute_javascript("document.getElementById('%s').scrollTop=%s;" % (self.Widget.identifier, 9999)) # 9999 number of pixel to scroll
super().Update(self.Widget, background_color=background_color, text_color=text_color, font=font, visible=visible) super().Update(self.Widget, background_color=background_color, text_color=text_color, font=font, visible=visible)
@ -2688,7 +2710,7 @@ class Window:
self.thread_id = None self.thread_id = None
self.App = None # type: Window.MyApp self.App = None # type: Window.MyApp
self.MessageQueue = Queue() self.MessageQueue = Queue()
self.master_widget = None self.master_widget = None # type: remi.gui.VBox
@classmethod @classmethod
def IncrementOpenCount(self): def IncrementOpenCount(self):
@ -3060,12 +3082,13 @@ class Window:
def Hide(self): def Hide(self):
self._Hidden = True self._Hidden = True
self.MasterFrame.Hide() self.master_widget.attributes['hidden'] = 'true'
# self.MasterFrame.Hide()
return return
def UnHide(self): def UnHide(self):
if self._Hidden: if self._Hidden:
self.MasterFrame.Show() del(self.master_widget.attributes['hidden'])
self._Hidden = False self._Hidden = False
def Disappear(self): def Disappear(self):
@ -3221,7 +3244,7 @@ class Window:
self.close() self.close()
self.server.server_starter_instance._alive = False self.server.server_starter_instance._alive = False
self.server.server_starter_instance._sserver.shutdown() self.server.server_starter_instance._sserver.shutdown()
self.window.MessageQueue.put(None) # self.window.MessageQueue.put(None)
print("server stopped") print("server stopped")
FlexForm = Window FlexForm = Window
@ -3915,12 +3938,18 @@ else:
AddMenuItem(top_menu, item, element) AddMenuItem(top_menu, item, element)
i += 1 i += 1
"""
# ------------------------------------------------------------------------------------------------------------------ # ::::::::: :::::::::: ::: ::: :::::::::::
# ------------------------------------------------------------------------------------------------------------------ # :+: :+: :+: :+:+: :+:+: :+:
# ===================================== TK CODE STARTS HERE ====================================================== # +:+ +:+ +:+ +:+ +:+:+ +:+ +:+
# ------------------------------------------------------------------------------------------------------------------ # +#++:++#: +#++:++# +#+ +:+ +#+ +#+
# ------------------------------------------------------------------------------------------------------------------ # +#+ +#+ +#+ +#+ +#+ +#+
#+# #+# #+# #+# #+# #+#
### ### ########## ### ### ###########
"""
# ------------------------------------------------------------------------------------------------------------ #
# ===================================== REMI CODE STARTS HERE ================================================ #
# ------------------------------------------------------------------------------------------------------------ #
def PackFormIntoFrame(form, containing_frame, toplevel_form): def PackFormIntoFrame(form, containing_frame, toplevel_form):
def CharWidthInPixels(): def CharWidthInPixels():
@ -3981,7 +4010,7 @@ def PackFormIntoFrame(form, containing_frame, toplevel_form):
# *********** Make TK Row ***********# # *********** Make TK Row ***********#
tk_row_frame = remi.gui.HBox() tk_row_frame = remi.gui.HBox()
if form.Justification.startswith('c'): if form.Justification.startswith('c'):
print('Centering row') # print('Centering row')
tk_row_frame.style['align-items'] = 'center' tk_row_frame.style['align-items'] = 'center'
tk_row_frame.style['justify-content'] = 'center' tk_row_frame.style['justify-content'] = 'center'
else: else:
@ -4033,7 +4062,7 @@ def PackFormIntoFrame(form, containing_frame, toplevel_form):
element = element # type: Column element = element # type: Column
element.Widget = column_widget = remi.gui.VBox() element.Widget = column_widget = remi.gui.VBox()
if element.Justification.startswith('c'): if element.Justification.startswith('c'):
print('CENTERING') # print('CENTERING')
column_widget.style['align-items'] = 'center' column_widget.style['align-items'] = 'center'
column_widget.style['justify-content'] = 'center' column_widget.style['justify-content'] = 'center'
else: else:
@ -4817,10 +4846,10 @@ def StartupTK(window:Window):
# if my_flex_form.KeepOnTop: # if my_flex_form.KeepOnTop:
# root.wm_attributes("-topmost", 1) # root.wm_attributes("-topmost", 1)
master = window.TKroot # master = window.TKroot
# Set Title # Set Title
# master.title(MyFlexForm.Title) # master.title(MyFlexForm.Title)
master = 00000 # master = 00000
InitializeResults(window) InitializeResults(window)