From 55210187e84a44abdcc8857cacab797c3ac42c50 Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Tue, 12 Feb 2019 16:09:59 -0500 Subject: [PATCH] Window.Hide, Window.UnHide --- PySimpleGUIWeb/PySimpleGUIWeb.py | 63 +++++++++++++++++++++++--------- 1 file changed, 46 insertions(+), 17 deletions(-) diff --git a/PySimpleGUIWeb/PySimpleGUIWeb.py b/PySimpleGUIWeb/PySimpleGUIWeb.py index 8aa3eece..aa55562d 100644 --- a/PySimpleGUIWeb/PySimpleGUIWeb.py +++ b/PySimpleGUIWeb/PySimpleGUIWeb.py @@ -35,12 +35,32 @@ def TimerStop(): g_time_delta = g_time_end - g_time_start 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! - It is based on the Remi GUI framework, an SDK that's been a real joy to work with + This special port of the PySimpleGUI SDK to the browser is made possible by the magic of Remi + + 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: self.CurrentValue = self.CurrentValue + '\n' + str(value) 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) @@ -2688,7 +2710,7 @@ class Window: self.thread_id = None self.App = None # type: Window.MyApp self.MessageQueue = Queue() - self.master_widget = None + self.master_widget = None # type: remi.gui.VBox @classmethod def IncrementOpenCount(self): @@ -3060,12 +3082,13 @@ class Window: def Hide(self): self._Hidden = True - self.MasterFrame.Hide() + self.master_widget.attributes['hidden'] = 'true' + # self.MasterFrame.Hide() return def UnHide(self): if self._Hidden: - self.MasterFrame.Show() + del(self.master_widget.attributes['hidden']) self._Hidden = False def Disappear(self): @@ -3221,7 +3244,7 @@ class Window: self.close() self.server.server_starter_instance._alive = False self.server.server_starter_instance._sserver.shutdown() - self.window.MessageQueue.put(None) + # self.window.MessageQueue.put(None) print("server stopped") FlexForm = Window @@ -3915,12 +3938,18 @@ else: AddMenuItem(top_menu, item, element) i += 1 - -# ------------------------------------------------------------------------------------------------------------------ # -# ------------------------------------------------------------------------------------------------------------------ # -# ===================================== TK CODE STARTS HERE ====================================================== # -# ------------------------------------------------------------------------------------------------------------------ # -# ------------------------------------------------------------------------------------------------------------------ # +""" + ::::::::: :::::::::: ::: ::: ::::::::::: + :+: :+: :+: :+:+: :+:+: :+: + +:+ +:+ +:+ +:+ +:+:+ +:+ +:+ + +#++:++#: +#++:++# +#+ +:+ +#+ +#+ + +#+ +#+ +#+ +#+ +#+ +#+ + #+# #+# #+# #+# #+# #+# + ### ### ########## ### ### ########### +""" +# ------------------------------------------------------------------------------------------------------------ # +# ===================================== REMI CODE STARTS HERE ================================================ # +# ------------------------------------------------------------------------------------------------------------ # def PackFormIntoFrame(form, containing_frame, toplevel_form): def CharWidthInPixels(): @@ -3981,7 +4010,7 @@ def PackFormIntoFrame(form, containing_frame, toplevel_form): # *********** Make TK Row ***********# tk_row_frame = remi.gui.HBox() if form.Justification.startswith('c'): - print('Centering row') + # print('Centering row') tk_row_frame.style['align-items'] = 'center' tk_row_frame.style['justify-content'] = 'center' else: @@ -4033,7 +4062,7 @@ def PackFormIntoFrame(form, containing_frame, toplevel_form): element = element # type: Column element.Widget = column_widget = remi.gui.VBox() if element.Justification.startswith('c'): - print('CENTERING') + # print('CENTERING') column_widget.style['align-items'] = 'center' column_widget.style['justify-content'] = 'center' else: @@ -4817,10 +4846,10 @@ def StartupTK(window:Window): # if my_flex_form.KeepOnTop: # root.wm_attributes("-topmost", 1) - master = window.TKroot + # master = window.TKroot # Set Title # master.title(MyFlexForm.Title) - master = 00000 + # master = 00000 InitializeResults(window)