diff --git a/PySimpleGUIWeb/PySimpleGUIWeb.py b/PySimpleGUIWeb/PySimpleGUIWeb.py index b5fbae9a..9b8c662e 100644 --- a/PySimpleGUIWeb/PySimpleGUIWeb.py +++ b/PySimpleGUIWeb/PySimpleGUIWeb.py @@ -3294,11 +3294,14 @@ class Window: self.master_widget.style['background-image'] = "url('{}')".format('/'+self.window.BackgroundImage) # print(f'background info',self.master_widget.attributes['background-image'] ) - # add the following 3 lines to your app and the on_window_close method to make the console close automatically - tag = remi.gui.Tag(_type='script') - tag.add_child("javascript", """window.onunload=function(e){sendCallback('%s','%s');return "close?";};""" % ( - str(id(self)), "on_window_close")) - self.master_widget.add_child("onunloadevent", tag) + if not self.window.DisableClose: + # add the following 3 lines to your app and the on_window_close method to make the console close automatically + tag = remi.gui.Tag(_type='script') + tag.add_child("javascript", """window.onunload=function(e){sendCallback('%s','%s');return "close?";};""" % ( + str(id(self)), "on_window_close")) + self.master_widget.add_child("onunloadevent", tag) + + self.window.MessageQueue.put('Layout complete') # signal the main code that the layout is all done self.window.master_widget = self.master_widget return self.master_widget # returning the root widget diff --git a/PySimpleGUIWeb/readme.md b/PySimpleGUIWeb/readme.md index 6c2ee6fa..b87fbb19 100644 --- a/PySimpleGUIWeb/readme.md +++ b/PySimpleGUIWeb/readme.md @@ -8,7 +8,7 @@ ![Python Version](https://img.shields.io/badge/Python-3.x-yellow.svg) -![Python Version](https://img.shields.io/badge/PySimpleGUIWeb_-0.20.0-orange.svg?longCache=true&style=for-the-badge) +![Python Version](https://img.shields.io/badge/PySimpleGUIWeb_-0.21.0-orange.svg?longCache=true&style=for-the-badge) @@ -288,6 +288,9 @@ New features * Changed web_update_interval=.0000001 from 0 (YIKES I HOPE SOMETHING DIDN'T BREAK!) +## 0.21.0 10-Apr-2019 PySimpleGUIWeb + +* If `disable_close` parameter set in Window call, then Remi will not disconnect when browser closed. Great for reconnecting. # Design # Author