Skip to content

Commit f4394b2

Browse files
committed
Added close parameter to Window.read
1 parent 0ef13e6 commit f4394b2

1 file changed

Lines changed: 23 additions & 2 deletions

File tree

PySimpleGUIWeb/PySimpleGUIWeb.py

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#usr/bin/python3
22

3-
version = __version__ = "0.37.0 Released 14 Apr 2020"
3+
version = __version__ = "0.37.0.1 Unreleased - Added close parameter to Window.read"
44

55
port = 'PySimpleGUIWeb'
66

@@ -2785,7 +2785,28 @@ def Show(self, non_blocking=False):
27852785

27862786

27872787

2788-
def Read(self, timeout=None, timeout_key=TIMEOUT_KEY):
2788+
2789+
def Read(self, timeout=None, timeout_key=TIMEOUT_KEY, close=False):
2790+
"""
2791+
THE biggest deal method in the Window class! This is how you get all of your data from your Window.
2792+
Pass in a timeout (in milliseconds) to wait for a maximum of timeout milliseconds. Will return timeout_key
2793+
if no other GUI events happen first.
2794+
Use the close parameter to close the window after reading
2795+
2796+
:param timeout: (int) Milliseconds to wait until the Read will return IF no other GUI events happen first
2797+
:param timeout_key: (Any) The value that will be returned from the call if the timer expired
2798+
:param close: (bool) if True the window will be closed prior to returning
2799+
:return: Tuple[(Any), Union[Dict[Any:Any]], List[Any], None] (event, values)
2800+
"""
2801+
results = self._read(timeout=timeout, timeout_key=timeout_key)
2802+
if close:
2803+
self.close()
2804+
2805+
return results
2806+
2807+
2808+
2809+
def _read(self, timeout=None, timeout_key=TIMEOUT_KEY):
27892810
# if timeout == 0: # timeout of zero runs the old readnonblocking
27902811
# event, values = self._ReadNonBlocking()
27912812
# if event is None:

0 commit comments

Comments
 (0)