Merge pull request #3156 from PySimpleGUI/Dev-latest

Release 4.25.0
This commit is contained in:
PySimpleGUI 2020-07-17 14:24:09 -04:00 committed by GitHub
commit 2fa210ec2d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 943 additions and 1638 deletions

View File

@ -1,6 +1,6 @@
#!/usr/bin/python3 #!/usr/bin/python3
version = __version__ = "4.24.0.18 Unreleased\nAdded k parameter to buttons, new text wrapping behavior for popups, new docstring for keys, new single-string button_color format ('white on red'), moved Tree image caching to be on a per-element basis rather than system wide, automatically refresh window when printing to multiline, Output element will now auto-refresh window after every print call, new paramters to Multiline to reroute stdout/stderr, turned off autoscroll for cprint and re-routed stdout prints, new Table, Tree parameter - selected_row_color, Table & Tree now use 2 colors to define the selected row - they default to the button color for the theme, new version of the fixed mapping function, added Window.make_modal, new modal parameter added to all popups, more theme_previewer parameters, Combo - don't select first entry if updated with a new set of values, multi-threaded support using Window.write_event_value, force preview tooltip to close when new tooltip shown" version = __version__ = "4.25.0 Released 17-Jul-2020"
port = 'PySimpleGUI' port = 'PySimpleGUI'
@ -6975,6 +6975,9 @@ class Window:
self.thread_queue = None # type: queue.Queue self.thread_queue = None # type: queue.Queue
self.thread_key = None # type: Any self.thread_key = None # type: Any
self.thread_strvar = None # type: tk.StringVar self.thread_strvar = None # type: tk.StringVar
self.read_closed_window_count = 0
if layout is not None and type(layout) not in (list, tuple): if layout is not None and type(layout) not in (list, tuple):
warnings.warn('Your layout is not a list or tuple... this is not good!') warnings.warn('Your layout is not a list or tuple... this is not good!')
@ -7357,6 +7360,9 @@ class Window:
self.TimeoutKey = timeout_key self.TimeoutKey = timeout_key
self.NonBlocking = False self.NonBlocking = False
if self.TKrootDestroyed: if self.TKrootDestroyed:
self.read_closed_window_count += 1
if self.read_closed_window_count > 100:
popup_error('You have tried 100 times to read a closed window.', 'You need to add a check for event == WIN_CLOSED', title='Trying to read a closed window')
return None, None return None, None
if not self.Shown: if not self.Shown:
self._Show() self._Show()
@ -8059,6 +8065,7 @@ class Window:
except: except:
pass pass
def SendToBack(self): def SendToBack(self):
""" """
Pushes this window to the bottom of the stack of windows. It is the opposite of BringToFront Pushes this window to the bottom of the stack of windows. It is the opposite of BringToFront
@ -8070,6 +8077,7 @@ class Window:
except: except:
pass pass
def CurrentLocation(self): def CurrentLocation(self):
""" """
Get the current location of the window's top left corner Get the current location of the window's top left corner
@ -8081,6 +8089,7 @@ class Window:
return return
return int(self.TKroot.winfo_x()), int(self.TKroot.winfo_y()) return int(self.TKroot.winfo_x()), int(self.TKroot.winfo_y())
@property @property
def Size(self): def Size(self):
""" """
@ -8095,6 +8104,7 @@ class Window:
win_height = self.TKroot.winfo_height() win_height = self.TKroot.winfo_height()
return win_width, win_height return win_width, win_height
@Size.setter @Size.setter
def Size(self, size): def Size(self, size):
""" """
@ -8109,6 +8119,7 @@ class Window:
except: except:
pass pass
def VisibilityChanged(self): def VisibilityChanged(self):
""" """
Not used in tkinter, but supplied becuase it is used in Qt. Want to remain source code compatible so that if Not used in tkinter, but supplied becuase it is used in Qt. Want to remain source code compatible so that if
@ -8118,6 +8129,7 @@ class Window:
# A dummy function. Needed in Qt but not tkinter # A dummy function. Needed in Qt but not tkinter
return return
def SetTransparentColor(self, color): def SetTransparentColor(self, color):
""" """
Set the color that will be transparent in your window. Areas with this color will be SEE THROUGH. Set the color that will be transparent in your window. Areas with this color will be SEE THROUGH.
@ -8132,6 +8144,7 @@ class Window:
except: except:
print('Transparent color not supported on this platform (windows only)') print('Transparent color not supported on this platform (windows only)')
def GrabAnyWhereOn(self): def GrabAnyWhereOn(self):
""" """
Turns on Grab Anywhere functionality AFTER a window has been created. Don't try on a window that's not yet Turns on Grab Anywhere functionality AFTER a window has been created. Don't try on a window that's not yet
@ -8143,6 +8156,7 @@ class Window:
self.TKroot.bind("<ButtonRelease-1>", self._StopMove) self.TKroot.bind("<ButtonRelease-1>", self._StopMove)
self.TKroot.bind("<B1-Motion>", self._OnMotion) self.TKroot.bind("<B1-Motion>", self._OnMotion)
def GrabAnyWhereOff(self): def GrabAnyWhereOff(self):
""" """
Turns off Grab Anywhere functionality AFTER a window has been created. Don't try on a window that's not yet Turns off Grab Anywhere functionality AFTER a window has been created. Don't try on a window that's not yet
@ -8154,6 +8168,7 @@ class Window:
self.TKroot.unbind("<ButtonRelease-1>") self.TKroot.unbind("<ButtonRelease-1>")
self.TKroot.unbind("<B1-Motion>") self.TKroot.unbind("<B1-Motion>")
def _user_bind_callback(self, bind_string, event): def _user_bind_callback(self, bind_string, event):
""" """
Used when user binds a tkinter event directly to an element Used when user binds a tkinter event directly to an element
@ -8173,6 +8188,7 @@ class Window:
if self.CurrentlyRunningMainloop: if self.CurrentlyRunningMainloop:
self.TKroot.quit() self.TKroot.quit()
def bind(self, bind_string, key): def bind(self, bind_string, key):
""" """
Used to add tkinter events to a Window. Used to add tkinter events to a Window.
@ -8187,6 +8203,7 @@ class Window:
self.TKroot.bind(bind_string, lambda evt: self._user_bind_callback(bind_string, evt)) self.TKroot.bind(bind_string, lambda evt: self._user_bind_callback(bind_string, evt))
self.user_bind_dict[bind_string] = key self.user_bind_dict[bind_string] = key
def _callback_main_debugger_window_create_keystroke(self, event): def _callback_main_debugger_window_create_keystroke(self, event):
""" """
Called when user presses the key that creates the main debugger window Called when user presses the key that creates the main debugger window
@ -8195,6 +8212,7 @@ class Window:
""" """
_Debugger.debugger._build_main_debugger_window() _Debugger.debugger._build_main_debugger_window()
def _callback_popout_window_create_keystroke(self, event): def _callback_popout_window_create_keystroke(self, event):
""" """
Called when user presses the key that creates the floating debugger window Called when user presses the key that creates the floating debugger window
@ -8203,6 +8221,7 @@ class Window:
""" """
_Debugger.debugger._build_floating_window() _Debugger.debugger._build_floating_window()
def EnableDebugger(self): def EnableDebugger(self):
""" """
Enables the internal debugger. By default, the debugger IS enabled Enables the internal debugger. By default, the debugger IS enabled
@ -8213,6 +8232,7 @@ class Window:
self.TKroot.bind('<Pause>', self._callback_popout_window_create_keystroke) self.TKroot.bind('<Pause>', self._callback_popout_window_create_keystroke)
self.DebuggerEnabled = True self.DebuggerEnabled = True
def DisableDebugger(self): def DisableDebugger(self):
""" """
Disable the internal debugger. By default the debugger is ENABLED Disable the internal debugger. By default the debugger is ENABLED
@ -8237,6 +8257,10 @@ class Window:
def make_modal(self): def make_modal(self):
"""
Makes a window into a "Modal Window"
This means user will not be able to interact with other windows until this one is closed
"""
if not self._is_window_created(): if not self._is_window_created():
return return
@ -8248,6 +8272,17 @@ class Window:
print('Exception trying to make modal', e) print('Exception trying to make modal', e)
def was_closed(self):
"""
Returns True if the window was closed
:return: True if the window is closed
:rtype: bool
"""
return self.TKrootDestroyed
def _window_tkvar_changed_callback(self, event, *args): def _window_tkvar_changed_callback(self, event, *args):
""" """
Internal callback function for when the thread Internal callback function for when the thread
@ -16847,7 +16882,7 @@ def main():
[Button('Button'), B('Hide Stuff', metadata='my metadata'), [Button('Button'), B('Hide Stuff', metadata='my metadata'),
Button('ttk Button', use_ttk_buttons=True, tooltip='This is a TTK Button'), Button('ttk Button', use_ttk_buttons=True, tooltip='This is a TTK Button'),
Button('See-through Mode', tooltip='Make the background transparent'), Button('See-through Mode', tooltip='Make the background transparent'),
Button('Install PySimpleGUI from GitHub', button_color='white on red', key='-INSTALL-'), Button('Updrade PySimpleGUI from GitHub', button_color='white on red', key='-INSTALL-'),
B('Popup'), B('Popup'),
Button('Exit', tooltip='Exit button')], Button('Exit', tooltip='Exit button')],
] ]
@ -16957,7 +16992,8 @@ test = main
theme(CURRENT_LOOK_AND_FEEL) theme(CURRENT_LOOK_AND_FEEL)
__tclversion_detailed__ = tkinter.Tcl().eval('info patchlevel') __tclversion_detailed__ = tkinter.Tcl().eval('info patchlevel')
if __tclversion_detailed__.startswith('8.5'):
warnings.warn('You are running a VERY old version of tkinter {}'.format(__tclversion_detailed__), UserWarning)
# -------------------------------- ENTRY POINT IF RUN STANDALONE -------------------------------- # # -------------------------------- ENTRY POINT IF RUN STANDALONE -------------------------------- #
if __name__ == '__main__': if __name__ == '__main__':

File diff suppressed because it is too large Load Diff

View File

@ -1448,7 +1448,8 @@ Popup(args=*<1 or N object>,
keep_on_top=False, keep_on_top=False,
location=(None, None), location=(None, None),
any_key_closes=False, any_key_closes=False,
image=None) image=None,
modal=True)
``` ```
Parameter Descriptions: Parameter Descriptions:
@ -1474,6 +1475,7 @@ Parameter Descriptions:
| bool | keep_on_top | If True the window will remain above all current windows | | bool | keep_on_top | If True the window will remain above all current windows |
| bool | any_key_closes | If True then will turn on return_keyboard_events for the window which will cause window to close as soon as any key is pressed. Normally the return key only will close the window. Default is false. | | bool | any_key_closes | If True then will turn on return_keyboard_events for the window which will cause window to close as soon as any key is pressed. Normally the return key only will close the window. Default is false. |
| str) or (bytes | image | Image to include at the top of the popup window | | str) or (bytes | image | Image to include at the top of the popup window |
| bool | modal | If True then makes the popup will behave like a Modal window... all other windows are non-operational until this one is closed. Default = False |
| Union[str, None] | **RETURN** | Returns text of the button that was pressed. None will be returned if user closed window with X | Union[str, None] | **RETURN** | Returns text of the button that was pressed. None will be returned if user closed window with X
The other output Popups are variations on parameters. Usually the button_type parameter is the primary one changed. The other output Popups are variations on parameters. Usually the button_type parameter is the primary one changed.
@ -1513,7 +1515,8 @@ popup_scrolled(args=*<1 or N object>,
grab_anywhere=False, grab_anywhere=False,
keep_on_top=False, keep_on_top=False,
font=None, font=None,
image=None) image=None,
modal=True)
``` ```
Parameter Descriptions: Parameter Descriptions:
@ -1522,7 +1525,7 @@ Parameter Descriptions:
|--|--|--| |--|--|--|
| Any | *args | Variable number of items to display | | Any | *args | Variable number of items to display |
| str | title | Title to display in the window. | | str | title | Title to display in the window. |
| Tuple[str, str] | button_color | button color (foreground, background) | | Tuple[str, str] or str | button_color | button color (foreground, background) |
| bool | yes_no | If True, displays Yes and No buttons instead of Ok | | bool | yes_no | If True, displays Yes and No buttons instead of Ok |
| bool | auto_close | if True window will close itself | | bool | auto_close | if True window will close itself |
| Union[int, float] | auto_close_duration | Older versions only accept int. Time in seconds until window will close | | Union[int, float] | auto_close_duration | Older versions only accept int. Time in seconds until window will close |
@ -1536,6 +1539,7 @@ Parameter Descriptions:
| bool | keep_on_top | If True the window will remain above all current windows | | bool | keep_on_top | If True the window will remain above all current windows |
| Union[str, Tuple[str, int]] | font | specifies the font family, size, etc | | Union[str, Tuple[str, int]] | font | specifies the font family, size, etc |
| str) or (bytes | image | Image to include at the top of the popup window | | str) or (bytes | image | Image to include at the top of the popup window |
| bool | modal | If True then makes the popup will behave like a Modal window... all other windows are non-operational until this one is closed. Default = False |
| Union[str, None, TIMEOUT_KEY] | **RETURN** | Returns text of the button that was pressed. None will be returned if user closed window with X | Union[str, None, TIMEOUT_KEY] | **RETURN** | Returns text of the button that was pressed. None will be returned if user closed window with X
Typical usage: Typical usage:
@ -1577,7 +1581,8 @@ popup_no_wait(args=*<1 or N object>,
grab_anywhere=False, grab_anywhere=False,
keep_on_top=False, keep_on_top=False,
location=(None, None), location=(None, None),
image=None) image=None,
modal=False)
``` ```
Parameter Descriptions: Parameter Descriptions:
@ -1587,7 +1592,7 @@ Parameter Descriptions:
| Any | *args | Variable number of items to display | | Any | *args | Variable number of items to display |
| str | title | Title to display in the window. | | str | title | Title to display in the window. |
| int | button_type | Determines which pre-defined buttons will be shown (Default value = POPUP_BUTTONS_OK). | | int | button_type | Determines which pre-defined buttons will be shown (Default value = POPUP_BUTTONS_OK). |
| Tuple[str, str] | button_color | button color (foreground, background) | | Tuple[str, str] or str | button_color | button color (foreground, background) |
| str | background_color | color of background | | str | background_color | color of background |
| str | text_color | color of the text | | str | text_color | color of the text |
| bool | auto_close | if True window will close itself | | bool | auto_close | if True window will close itself |
@ -1600,6 +1605,7 @@ Parameter Descriptions:
| bool | grab_anywhere | If True: can grab anywhere to move the window (Default = False) | | bool | grab_anywhere | If True: can grab anywhere to move the window (Default = False) |
| Tuple[int, int] | location | Location of upper left corner of the window | | Tuple[int, int] | location | Location of upper left corner of the window |
| str) or (bytes | image | Image to include at the top of the popup window | | str) or (bytes | image | Image to include at the top of the popup window |
| bool | modal | If True then makes the popup will behave like a Modal window... all other windows are non-operational until this one is closed. Default = False |
| Union[str, None] | **RETURN** | Reason for popup closing | Union[str, None] | **RETURN** | Reason for popup closing
The `popup` call `popup_no_wait` or `popup_non_blocking` will create a popup window and then immediately return control back to you. You can turn other popup calls into non-blocking popups if they have a `non_blocking` parameter. Setting `non_blocking` to True will cause the function to return immediately rather than waiting for the window to be closed. The `popup` call `popup_no_wait` or `popup_non_blocking` will create a popup window and then immediately return control back to you. You can turn other popup calls into non-blocking popups if they have a `non_blocking` parameter. Setting `non_blocking` to True will cause the function to return immediately rather than waiting for the window to be closed.
@ -1640,7 +1646,8 @@ popup_get_text(message,
grab_anywhere=False, grab_anywhere=False,
keep_on_top=False, keep_on_top=False,
location=(None, None), location=(None, None),
image=None) image=None,
modal=True)
``` ```
Parameter Descriptions: Parameter Descriptions:
@ -1652,7 +1659,7 @@ Parameter Descriptions:
| str | default_text | default value to put into input area | | str | default_text | default value to put into input area |
| str | password_char | character to be shown instead of actually typed characters | | str | password_char | character to be shown instead of actually typed characters |
| (int, int) | size | (width, height) of the InputText Element | | (int, int) | size | (width, height) of the InputText Element |
| Tuple[str, str] | button_color | Color of the button (text, background) | | Tuple[str, str] or str | button_color | Color of the button (text, background) |
| str | background_color | background color of the entire window | | str | background_color | background color of the entire window |
| str | text_color | color of the message text | | str | text_color | color of the message text |
| Union[bytes, str] | icon | filename or base64 string to be used for the window's icon | | Union[bytes, str] | icon | filename or base64 string to be used for the window's icon |
@ -1662,6 +1669,7 @@ Parameter Descriptions:
| bool | keep_on_top | If True the window will remain above all current windows | | bool | keep_on_top | If True the window will remain above all current windows |
| Tuple[int, int] | location | (x,y) Location on screen to display the upper left corner of window | | Tuple[int, int] | location | (x,y) Location on screen to display the upper left corner of window |
| str) or (bytes | image | Image to include at the top of the popup window | | str) or (bytes | image | Image to include at the top of the popup window |
| bool | modal | If True then makes the popup will behave like a Modal window... all other windows are non-operational until this one is closed. Default = False |
| Union[str, None] | **RETURN** | Text entered or None if window was closed or cancel button clicked | Union[str, None] | **RETURN** | Text entered or None if window was closed or cancel button clicked
```python ```python
@ -1700,7 +1708,8 @@ popup_get_file(message,
keep_on_top=False, keep_on_top=False,
location=(None, None), location=(None, None),
initial_folder=None, initial_folder=None,
image=None) image=None,
modal=True)
``` ```
Parameter Descriptions: Parameter Descriptions:
@ -1716,7 +1725,7 @@ Parameter Descriptions:
| Tuple[Tuple[str,str]] | file_types | List of extensions to show using wildcards. All files (the default) = (("ALL Files", "*.*"),) | | Tuple[Tuple[str,str]] | file_types | List of extensions to show using wildcards. All files (the default) = (("ALL Files", "*.*"),) |
| bool | no_window | if True, no PySimpleGUI window will be shown. Instead just the tkinter dialog is shown | | bool | no_window | if True, no PySimpleGUI window will be shown. Instead just the tkinter dialog is shown |
| (int, int) | size | (width, height) of the InputText Element | | (int, int) | size | (width, height) of the InputText Element |
| Tuple[str, str] | button_color | Color of the button (text, background) | | Tuple[str, str] or str | button_color | Color of the button (text, background) |
| str | background_color | background color of the entire window | | str | background_color | background color of the entire window |
| str | text_color | color of the text | | str | text_color | color of the text |
| Union[bytes, str] | icon | filename or base64 string to be used for the window's icon | | Union[bytes, str] | icon | filename or base64 string to be used for the window's icon |
@ -1727,6 +1736,7 @@ Parameter Descriptions:
| Tuple[int, int] | location | Location of upper left corner of the window | | Tuple[int, int] | location | Location of upper left corner of the window |
| str | initial_folder | location in filesystem to begin browsing | | str | initial_folder | location in filesystem to begin browsing |
| str) or (bytes | image | Image to include at the top of the popup window | | str) or (bytes | image | Image to include at the top of the popup window |
| bool | modal | If True then makes the popup will behave like a Modal window... all other windows are non-operational until this one is closed. Default = False |
| Union[str, None] | **RETURN** | string representing the file(s) chosen, None if cancelled or window closed with X | Union[str, None] | **RETURN** | string representing the file(s) chosen, None if cancelled or window closed with X
If configured as an Open File Popup then (save_as is not True) the dialog box will look like this. If configured as an Open File Popup then (save_as is not True) the dialog box will look like this.
@ -1770,7 +1780,8 @@ popup_get_folder(message,
keep_on_top=False, keep_on_top=False,
location=(None, None), location=(None, None),
initial_folder=None, initial_folder=None,
image=None) image=None,
modal=True)
``` ```
Parameter Descriptions: Parameter Descriptions:
@ -1782,7 +1793,7 @@ Parameter Descriptions:
| str | default_path | path to display to user as starting point (filled into the input field) | | str | default_path | path to display to user as starting point (filled into the input field) |
| bool | no_window | if True, no PySimpleGUI window will be shown. Instead just the tkinter dialog is shown | | bool | no_window | if True, no PySimpleGUI window will be shown. Instead just the tkinter dialog is shown |
| (int, int) | size | (width, height) of the InputText Element | | (int, int) | size | (width, height) of the InputText Element |
| Tuple[str, str] | button_color | button color (foreground, background) | | Tuple[str, str] or str | button_color | button color (foreground, background) |
| str | background_color | color of background | | str | background_color | color of background |
| str | text_color | color of the text | | str | text_color | color of the text |
| Union[bytes, str] | icon | filename or base64 string to be used for the window's icon | | Union[bytes, str] | icon | filename or base64 string to be used for the window's icon |
@ -1793,6 +1804,7 @@ Parameter Descriptions:
| Tuple[int, int] | location | Location of upper left corner of the window | | Tuple[int, int] | location | Location of upper left corner of the window |
| str | initial_folder | location in filesystem to begin browsing | | str | initial_folder | location in filesystem to begin browsing |
| str) or (bytes | image | Image to include at the top of the popup window | | str) or (bytes | image | Image to include at the top of the popup window |
| bool | modal | If True then makes the popup will behave like a Modal window... all other windows are non-operational until this one is closed. Default = False |
| Union[str, None] | **RETURN** | string representing the path chosen, None if cancelled or window closed with X | Union[str, None] | **RETURN** | string representing the path chosen, None if cancelled or window closed with X
This is a typical call This is a typical call
@ -1879,11 +1891,11 @@ Parameter Descriptions:
| str | title | text to display in eleemnt | | str | title | text to display in eleemnt |
| int | current_value | current value | | int | current_value | current value |
| int | max_value | max value of QuickMeter | | int | max_value | max value of QuickMeter |
| Union[str, int, tuple] | key | Used to differentiate between mutliple meters. Used to cancel meter early. Now optional as there is a default value for single meters | | Union[str, int, tuple, object] | key | Used to differentiate between mutliple meters. Used to cancel meter early. Now optional as there is a default value for single meters |
| Any | *args | stuff to output | | Any | *args | stuff to output |
| str | orientation | 'horizontal' or 'vertical' ('h' or 'v' work) (Default value = 'vertical' / 'v') | | str | orientation | 'horizontal' or 'vertical' ('h' or 'v' work) (Default value = 'vertical' / 'v') |
| Tuple(str, str) | bar_color | color of a bar line | | Tuple(str, str) | bar_color | color of a bar line |
| Tuple[str, str] | button_color | button color (foreground, background) | | Tuple[str, str] or str | button_color | button color (foreground, background) |
| (int, int) | size | (w,h) w=characters-wide, h=rows-high (Default value = DEFAULT_PROGRESS_BAR_SIZE) | | (int, int) | size | (w,h) w=characters-wide, h=rows-high (Default value = DEFAULT_PROGRESS_BAR_SIZE) |
| int | border_width | width of border around element | | int | border_width | width of border around element |
| bool | grab_anywhere | If True: can grab anywhere to move the window (Default = False) | | bool | grab_anywhere | If True: can grab anywhere to move the window (Default = False) |
@ -7322,6 +7334,56 @@ Selective control over tk 8.6.9 treeview color patch
* Can enable the patched code by calling set_options * Can enable the patched code by calling set_options
* To enable set parameter enable_treeview_869_patch = True (defaults to false) * To enable set parameter enable_treeview_869_patch = True (defaults to false)
## 4.25.0 PySimpleGUI 17-Jul-2020
Biggest / most impactful set of changes in a while (fingers crossed)
Modal windows
Multithreaded Window.write_event_value method
stdout re-route to any Multiline
table/tree highlights
k element parameter
* New "k" parameter for all elements.
* Same as "key"
* Created so layouts can be even more compact if desired
* New docstring for keys (basically anything except a list)
* Popups
* New text wrap behavior. Will wrap text between \n in user's string
* All popups are now "modal" unless they are non-blocking (can be turned off using new parameter)
* New button color and table/tree highlight color format
* Colors can still be tuple (text, background)
* Can also be a single string with format "text on background" (e.g. "white on red")
* Multiline
* Automatically refresh window when updating multiline or output elements
* For cprint use Multiline's autoscroll setting
* New autoscroll parameter in Multiline.print
* New parameters to make the print and cprint stuff much easier
* write_only=False (so that it's not returned when read)
* auto_refresh=False
* reroute_stdout=False
* reroute_stderr=False
* reroute_cprint=False (removes need to call the cprint cprint_set_output_destination function)
* Table / Tree Elements
* Re-enabled the tk 8.6.9 background color fix again
* selected_row_colors=(None, None) - tuple or string
* Automatically sets the selected row color based on the theme colors! (uses the button color)
* Can use 2 other constants for colors
* OLD_TABLE_TREE_SELECTED_ROW_COLORS - ('#FFFFFF', '#4A6984') the old blueish color
* ALTERNATE_TABLE_AND_TREE_SELECTED_ROW_COLORS - (SystemHighlightText, SystemHighlight)
* Tree image caching happens at the element level now
* Window
* make_modal - new method to turn a window into a modal window
* modal parameter when window is created. Default is False
* write_event_value - new method that can be called by threads! This will "queue" an event and a value for the next window.read()
* Display an error popup if read a closed window 100+ times (stops you from eating 100% of the CPU time)
* was_closed method added - returns True if a window has been closed
* Combo - don't select first entry if updated with a new set of values
* Tooltip - fix for stuck-on tooltips
* New theme_previewer with scrollbars. 3 new parameters
* cprint - now has all parameters shown in docstring versus using *args **kwargs
* New global variable __tclversion_detailed__ - string with full tkinter version (3 numbers instead of 2)
* Warning is displayed if tcl version is found to be 8.5.
### Upcoming ### Upcoming
There will always be overlapping work as the ports will never actually be "complete" as there's always something new that can be built. However there's a definition for the base functionality for PySimpleGUI. This is what is being strived for with the current ports that are underway. There will always be overlapping work as the ports will never actually be "complete" as there's always something new that can be built. However there's a definition for the base functionality for PySimpleGUI. This is what is being strived for with the current ports that are underway.

View File

@ -1448,7 +1448,8 @@ Popup(args=*<1 or N object>,
keep_on_top=False, keep_on_top=False,
location=(None, None), location=(None, None),
any_key_closes=False, any_key_closes=False,
image=None) image=None,
modal=True)
``` ```
Parameter Descriptions: Parameter Descriptions:
@ -1474,6 +1475,7 @@ Parameter Descriptions:
| bool | keep_on_top | If True the window will remain above all current windows | | bool | keep_on_top | If True the window will remain above all current windows |
| bool | any_key_closes | If True then will turn on return_keyboard_events for the window which will cause window to close as soon as any key is pressed. Normally the return key only will close the window. Default is false. | | bool | any_key_closes | If True then will turn on return_keyboard_events for the window which will cause window to close as soon as any key is pressed. Normally the return key only will close the window. Default is false. |
| str) or (bytes | image | Image to include at the top of the popup window | | str) or (bytes | image | Image to include at the top of the popup window |
| bool | modal | If True then makes the popup will behave like a Modal window... all other windows are non-operational until this one is closed. Default = False |
| Union[str, None] | **RETURN** | Returns text of the button that was pressed. None will be returned if user closed window with X | Union[str, None] | **RETURN** | Returns text of the button that was pressed. None will be returned if user closed window with X
The other output Popups are variations on parameters. Usually the button_type parameter is the primary one changed. The other output Popups are variations on parameters. Usually the button_type parameter is the primary one changed.
@ -1513,7 +1515,8 @@ popup_scrolled(args=*<1 or N object>,
grab_anywhere=False, grab_anywhere=False,
keep_on_top=False, keep_on_top=False,
font=None, font=None,
image=None) image=None,
modal=True)
``` ```
Parameter Descriptions: Parameter Descriptions:
@ -1522,7 +1525,7 @@ Parameter Descriptions:
|--|--|--| |--|--|--|
| Any | *args | Variable number of items to display | | Any | *args | Variable number of items to display |
| str | title | Title to display in the window. | | str | title | Title to display in the window. |
| Tuple[str, str] | button_color | button color (foreground, background) | | Tuple[str, str] or str | button_color | button color (foreground, background) |
| bool | yes_no | If True, displays Yes and No buttons instead of Ok | | bool | yes_no | If True, displays Yes and No buttons instead of Ok |
| bool | auto_close | if True window will close itself | | bool | auto_close | if True window will close itself |
| Union[int, float] | auto_close_duration | Older versions only accept int. Time in seconds until window will close | | Union[int, float] | auto_close_duration | Older versions only accept int. Time in seconds until window will close |
@ -1536,6 +1539,7 @@ Parameter Descriptions:
| bool | keep_on_top | If True the window will remain above all current windows | | bool | keep_on_top | If True the window will remain above all current windows |
| Union[str, Tuple[str, int]] | font | specifies the font family, size, etc | | Union[str, Tuple[str, int]] | font | specifies the font family, size, etc |
| str) or (bytes | image | Image to include at the top of the popup window | | str) or (bytes | image | Image to include at the top of the popup window |
| bool | modal | If True then makes the popup will behave like a Modal window... all other windows are non-operational until this one is closed. Default = False |
| Union[str, None, TIMEOUT_KEY] | **RETURN** | Returns text of the button that was pressed. None will be returned if user closed window with X | Union[str, None, TIMEOUT_KEY] | **RETURN** | Returns text of the button that was pressed. None will be returned if user closed window with X
Typical usage: Typical usage:
@ -1577,7 +1581,8 @@ popup_no_wait(args=*<1 or N object>,
grab_anywhere=False, grab_anywhere=False,
keep_on_top=False, keep_on_top=False,
location=(None, None), location=(None, None),
image=None) image=None,
modal=False)
``` ```
Parameter Descriptions: Parameter Descriptions:
@ -1587,7 +1592,7 @@ Parameter Descriptions:
| Any | *args | Variable number of items to display | | Any | *args | Variable number of items to display |
| str | title | Title to display in the window. | | str | title | Title to display in the window. |
| int | button_type | Determines which pre-defined buttons will be shown (Default value = POPUP_BUTTONS_OK). | | int | button_type | Determines which pre-defined buttons will be shown (Default value = POPUP_BUTTONS_OK). |
| Tuple[str, str] | button_color | button color (foreground, background) | | Tuple[str, str] or str | button_color | button color (foreground, background) |
| str | background_color | color of background | | str | background_color | color of background |
| str | text_color | color of the text | | str | text_color | color of the text |
| bool | auto_close | if True window will close itself | | bool | auto_close | if True window will close itself |
@ -1600,6 +1605,7 @@ Parameter Descriptions:
| bool | grab_anywhere | If True: can grab anywhere to move the window (Default = False) | | bool | grab_anywhere | If True: can grab anywhere to move the window (Default = False) |
| Tuple[int, int] | location | Location of upper left corner of the window | | Tuple[int, int] | location | Location of upper left corner of the window |
| str) or (bytes | image | Image to include at the top of the popup window | | str) or (bytes | image | Image to include at the top of the popup window |
| bool | modal | If True then makes the popup will behave like a Modal window... all other windows are non-operational until this one is closed. Default = False |
| Union[str, None] | **RETURN** | Reason for popup closing | Union[str, None] | **RETURN** | Reason for popup closing
The `popup` call `popup_no_wait` or `popup_non_blocking` will create a popup window and then immediately return control back to you. You can turn other popup calls into non-blocking popups if they have a `non_blocking` parameter. Setting `non_blocking` to True will cause the function to return immediately rather than waiting for the window to be closed. The `popup` call `popup_no_wait` or `popup_non_blocking` will create a popup window and then immediately return control back to you. You can turn other popup calls into non-blocking popups if they have a `non_blocking` parameter. Setting `non_blocking` to True will cause the function to return immediately rather than waiting for the window to be closed.
@ -1640,7 +1646,8 @@ popup_get_text(message,
grab_anywhere=False, grab_anywhere=False,
keep_on_top=False, keep_on_top=False,
location=(None, None), location=(None, None),
image=None) image=None,
modal=True)
``` ```
Parameter Descriptions: Parameter Descriptions:
@ -1652,7 +1659,7 @@ Parameter Descriptions:
| str | default_text | default value to put into input area | | str | default_text | default value to put into input area |
| str | password_char | character to be shown instead of actually typed characters | | str | password_char | character to be shown instead of actually typed characters |
| (int, int) | size | (width, height) of the InputText Element | | (int, int) | size | (width, height) of the InputText Element |
| Tuple[str, str] | button_color | Color of the button (text, background) | | Tuple[str, str] or str | button_color | Color of the button (text, background) |
| str | background_color | background color of the entire window | | str | background_color | background color of the entire window |
| str | text_color | color of the message text | | str | text_color | color of the message text |
| Union[bytes, str] | icon | filename or base64 string to be used for the window's icon | | Union[bytes, str] | icon | filename or base64 string to be used for the window's icon |
@ -1662,6 +1669,7 @@ Parameter Descriptions:
| bool | keep_on_top | If True the window will remain above all current windows | | bool | keep_on_top | If True the window will remain above all current windows |
| Tuple[int, int] | location | (x,y) Location on screen to display the upper left corner of window | | Tuple[int, int] | location | (x,y) Location on screen to display the upper left corner of window |
| str) or (bytes | image | Image to include at the top of the popup window | | str) or (bytes | image | Image to include at the top of the popup window |
| bool | modal | If True then makes the popup will behave like a Modal window... all other windows are non-operational until this one is closed. Default = False |
| Union[str, None] | **RETURN** | Text entered or None if window was closed or cancel button clicked | Union[str, None] | **RETURN** | Text entered or None if window was closed or cancel button clicked
```python ```python
@ -1700,7 +1708,8 @@ popup_get_file(message,
keep_on_top=False, keep_on_top=False,
location=(None, None), location=(None, None),
initial_folder=None, initial_folder=None,
image=None) image=None,
modal=True)
``` ```
Parameter Descriptions: Parameter Descriptions:
@ -1716,7 +1725,7 @@ Parameter Descriptions:
| Tuple[Tuple[str,str]] | file_types | List of extensions to show using wildcards. All files (the default) = (("ALL Files", "*.*"),) | | Tuple[Tuple[str,str]] | file_types | List of extensions to show using wildcards. All files (the default) = (("ALL Files", "*.*"),) |
| bool | no_window | if True, no PySimpleGUI window will be shown. Instead just the tkinter dialog is shown | | bool | no_window | if True, no PySimpleGUI window will be shown. Instead just the tkinter dialog is shown |
| (int, int) | size | (width, height) of the InputText Element | | (int, int) | size | (width, height) of the InputText Element |
| Tuple[str, str] | button_color | Color of the button (text, background) | | Tuple[str, str] or str | button_color | Color of the button (text, background) |
| str | background_color | background color of the entire window | | str | background_color | background color of the entire window |
| str | text_color | color of the text | | str | text_color | color of the text |
| Union[bytes, str] | icon | filename or base64 string to be used for the window's icon | | Union[bytes, str] | icon | filename or base64 string to be used for the window's icon |
@ -1727,6 +1736,7 @@ Parameter Descriptions:
| Tuple[int, int] | location | Location of upper left corner of the window | | Tuple[int, int] | location | Location of upper left corner of the window |
| str | initial_folder | location in filesystem to begin browsing | | str | initial_folder | location in filesystem to begin browsing |
| str) or (bytes | image | Image to include at the top of the popup window | | str) or (bytes | image | Image to include at the top of the popup window |
| bool | modal | If True then makes the popup will behave like a Modal window... all other windows are non-operational until this one is closed. Default = False |
| Union[str, None] | **RETURN** | string representing the file(s) chosen, None if cancelled or window closed with X | Union[str, None] | **RETURN** | string representing the file(s) chosen, None if cancelled or window closed with X
If configured as an Open File Popup then (save_as is not True) the dialog box will look like this. If configured as an Open File Popup then (save_as is not True) the dialog box will look like this.
@ -1770,7 +1780,8 @@ popup_get_folder(message,
keep_on_top=False, keep_on_top=False,
location=(None, None), location=(None, None),
initial_folder=None, initial_folder=None,
image=None) image=None,
modal=True)
``` ```
Parameter Descriptions: Parameter Descriptions:
@ -1782,7 +1793,7 @@ Parameter Descriptions:
| str | default_path | path to display to user as starting point (filled into the input field) | | str | default_path | path to display to user as starting point (filled into the input field) |
| bool | no_window | if True, no PySimpleGUI window will be shown. Instead just the tkinter dialog is shown | | bool | no_window | if True, no PySimpleGUI window will be shown. Instead just the tkinter dialog is shown |
| (int, int) | size | (width, height) of the InputText Element | | (int, int) | size | (width, height) of the InputText Element |
| Tuple[str, str] | button_color | button color (foreground, background) | | Tuple[str, str] or str | button_color | button color (foreground, background) |
| str | background_color | color of background | | str | background_color | color of background |
| str | text_color | color of the text | | str | text_color | color of the text |
| Union[bytes, str] | icon | filename or base64 string to be used for the window's icon | | Union[bytes, str] | icon | filename or base64 string to be used for the window's icon |
@ -1793,6 +1804,7 @@ Parameter Descriptions:
| Tuple[int, int] | location | Location of upper left corner of the window | | Tuple[int, int] | location | Location of upper left corner of the window |
| str | initial_folder | location in filesystem to begin browsing | | str | initial_folder | location in filesystem to begin browsing |
| str) or (bytes | image | Image to include at the top of the popup window | | str) or (bytes | image | Image to include at the top of the popup window |
| bool | modal | If True then makes the popup will behave like a Modal window... all other windows are non-operational until this one is closed. Default = False |
| Union[str, None] | **RETURN** | string representing the path chosen, None if cancelled or window closed with X | Union[str, None] | **RETURN** | string representing the path chosen, None if cancelled or window closed with X
This is a typical call This is a typical call
@ -1879,11 +1891,11 @@ Parameter Descriptions:
| str | title | text to display in eleemnt | | str | title | text to display in eleemnt |
| int | current_value | current value | | int | current_value | current value |
| int | max_value | max value of QuickMeter | | int | max_value | max value of QuickMeter |
| Union[str, int, tuple] | key | Used to differentiate between mutliple meters. Used to cancel meter early. Now optional as there is a default value for single meters | | Union[str, int, tuple, object] | key | Used to differentiate between mutliple meters. Used to cancel meter early. Now optional as there is a default value for single meters |
| Any | *args | stuff to output | | Any | *args | stuff to output |
| str | orientation | 'horizontal' or 'vertical' ('h' or 'v' work) (Default value = 'vertical' / 'v') | | str | orientation | 'horizontal' or 'vertical' ('h' or 'v' work) (Default value = 'vertical' / 'v') |
| Tuple(str, str) | bar_color | color of a bar line | | Tuple(str, str) | bar_color | color of a bar line |
| Tuple[str, str] | button_color | button color (foreground, background) | | Tuple[str, str] or str | button_color | button color (foreground, background) |
| (int, int) | size | (w,h) w=characters-wide, h=rows-high (Default value = DEFAULT_PROGRESS_BAR_SIZE) | | (int, int) | size | (w,h) w=characters-wide, h=rows-high (Default value = DEFAULT_PROGRESS_BAR_SIZE) |
| int | border_width | width of border around element | | int | border_width | width of border around element |
| bool | grab_anywhere | If True: can grab anywhere to move the window (Default = False) | | bool | grab_anywhere | If True: can grab anywhere to move the window (Default = False) |
@ -7322,6 +7334,56 @@ Selective control over tk 8.6.9 treeview color patch
* Can enable the patched code by calling set_options * Can enable the patched code by calling set_options
* To enable set parameter enable_treeview_869_patch = True (defaults to false) * To enable set parameter enable_treeview_869_patch = True (defaults to false)
## 4.25.0 PySimpleGUI 17-Jul-2020
Biggest / most impactful set of changes in a while (fingers crossed)
Modal windows
Multithreaded Window.write_event_value method
stdout re-route to any Multiline
table/tree highlights
k element parameter
* New "k" parameter for all elements.
* Same as "key"
* Created so layouts can be even more compact if desired
* New docstring for keys (basically anything except a list)
* Popups
* New text wrap behavior. Will wrap text between \n in user's string
* All popups are now "modal" unless they are non-blocking (can be turned off using new parameter)
* New button color and table/tree highlight color format
* Colors can still be tuple (text, background)
* Can also be a single string with format "text on background" (e.g. "white on red")
* Multiline
* Automatically refresh window when updating multiline or output elements
* For cprint use Multiline's autoscroll setting
* New autoscroll parameter in Multiline.print
* New parameters to make the print and cprint stuff much easier
* write_only=False (so that it's not returned when read)
* auto_refresh=False
* reroute_stdout=False
* reroute_stderr=False
* reroute_cprint=False (removes need to call the cprint cprint_set_output_destination function)
* Table / Tree Elements
* Re-enabled the tk 8.6.9 background color fix again
* selected_row_colors=(None, None) - tuple or string
* Automatically sets the selected row color based on the theme colors! (uses the button color)
* Can use 2 other constants for colors
* OLD_TABLE_TREE_SELECTED_ROW_COLORS - ('#FFFFFF', '#4A6984') the old blueish color
* ALTERNATE_TABLE_AND_TREE_SELECTED_ROW_COLORS - (SystemHighlightText, SystemHighlight)
* Tree image caching happens at the element level now
* Window
* make_modal - new method to turn a window into a modal window
* modal parameter when window is created. Default is False
* write_event_value - new method that can be called by threads! This will "queue" an event and a value for the next window.read()
* Display an error popup if read a closed window 100+ times (stops you from eating 100% of the CPU time)
* was_closed method added - returns True if a window has been closed
* Combo - don't select first entry if updated with a new set of values
* Tooltip - fix for stuck-on tooltips
* New theme_previewer with scrollbars. 3 new parameters
* cprint - now has all parameters shown in docstring versus using *args **kwargs
* New global variable __tclversion_detailed__ - string with full tkinter version (3 numbers instead of 2)
* Warning is displayed if tcl version is found to be 8.5.
### Upcoming ### Upcoming
There will always be overlapping work as the ports will never actually be "complete" as there's always something new that can be built. However there's a definition for the base functionality for PySimpleGUI. This is what is being strived for with the current ports that are underway. There will always be overlapping work as the ports will never actually be "complete" as there's always something new that can be built. However there's a definition for the base functionality for PySimpleGUI. This is what is being strived for with the current ports that are underway.