Release 4.51.0

This commit is contained in:
PySimpleGUI 2021-10-18 14:28:39 -04:00
parent f16eed5b67
commit a05af0ad97
6 changed files with 38 additions and 3 deletions

View File

@ -1,10 +1,10 @@
#!/usr/bin/python3 #!/usr/bin/python3
version = __version__ = "4.50.0 Released 17-Oct-2021" version = __version__ = "4.51.0 Released 18-Oct-2021"
_change_log = """ _change_log = """
Changelog since 4.50.0 release to PyPI on 17-Oct-2021 Changelog since 4.51.0 release to PyPI on 18-Oct-2021
""" """
@ -8308,7 +8308,7 @@ class Window:
def __init__(self, title, layout=None, default_element_size=None, def __init__(self, title, layout=None, default_element_size=None,
default_button_element_size=(None, None), default_button_element_size=(None, None),
auto_size_text=None, auto_size_buttons=None, location=(None, None), size=(None, None), auto_size_text=None, auto_size_buttons=None, location=(None, None), relative_location=(None, None), size=(None, None),
element_padding=None, margins=(None, None), button_color=None, font=None, element_padding=None, margins=(None, None), button_color=None, font=None,
progress_bar_color=(None, None), background_color=None, border_depth=None, auto_close=False, progress_bar_color=(None, None), background_color=None, border_depth=None, auto_close=False,
auto_close_duration=DEFAULT_AUTOCLOSE_TIME, icon=None, force_toplevel=False, auto_close_duration=DEFAULT_AUTOCLOSE_TIME, icon=None, force_toplevel=False,
@ -8334,6 +8334,8 @@ class Window:
:type auto_size_text: (bool) :type auto_size_text: (bool)
:param auto_size_buttons: True if Buttons in this Window should be sized to exactly fit the text on this. :param auto_size_buttons: True if Buttons in this Window should be sized to exactly fit the text on this.
:type auto_size_buttons: (bool) :type auto_size_buttons: (bool)
:param relative_location: (x,y) location relative to the CENTER of the window, in pixels. Normally the window centers. This location is relative to THAT centered location. Note they can be negative.
:type relative_location: (int, int)
:param location: (x,y) location, in pixels, to locate the upper left corner of the window on the screen. Default is to center on screen. :param location: (x,y) location, in pixels, to locate the upper left corner of the window on the screen. Default is to center on screen.
:type location: (int, int) :type location: (int, int)
:param size: (width, height) size in pixels for this window. Normally the window is autosized to fit contents, not set to an absolute size by the user. Try not to set this value. You risk, the contents being cut off, etc. Let the layout determine the window size instead :param size: (width, height) size in pixels for this window. Normally the window is autosized to fit contents, not set to an absolute size by the user. Try not to set this value. You risk, the contents being cut off, etc. Let the layout determine the window size instead
@ -8433,6 +8435,7 @@ class Window:
self.DefaultButtonElementSize = default_button_element_size if default_button_element_size != ( self.DefaultButtonElementSize = default_button_element_size if default_button_element_size != (
None, None) else DEFAULT_BUTTON_ELEMENT_SIZE None, None) else DEFAULT_BUTTON_ELEMENT_SIZE
self.Location = location self.Location = location
self.RelativeLoction = relative_location
self.ButtonColor = button_color_to_tuple(button_color) self.ButtonColor = button_color_to_tuple(button_color)
self.BackgroundColor = background_color if background_color else DEFAULT_BACKGROUND_COLOR self.BackgroundColor = background_color if background_color else DEFAULT_BACKGROUND_COLOR
self.ParentWindow = None self.ParentWindow = None
@ -15070,6 +15073,10 @@ def _convert_window_to_tk(window):
if x + win_width > screen_width: if x + win_width > screen_width:
x = screen_width - win_width x = screen_width - win_width
if window.RelativeLoction != (None, None):
x += window.RelativeLoction[0]
y += window.RelativeLoction[1]
move_string = '+%i+%i' % (int(x), int(y)) move_string = '+%i+%i' % (int(x), int(y))
master.geometry(move_string) master.geometry(move_string)
window.config_last_location = (int(x), (int(y))) window.config_last_location = (int(x), (int(y)))

View File

@ -11363,6 +11363,7 @@ Window(title,
auto_size_text = None, auto_size_text = None,
auto_size_buttons = None, auto_size_buttons = None,
location = (None, None), location = (None, None),
relative_location = (None, None),
size = (None, None), size = (None, None),
element_padding = None, element_padding = None,
margins = (None, None), margins = (None, None),
@ -11418,6 +11419,7 @@ Parameter Descriptions:
| (int, int) | default_button_element_size | (width, height) size in characters (wide) and rows (high) for all Button elements in this window | | (int, int) | default_button_element_size | (width, height) size in characters (wide) and rows (high) for all Button elements in this window |
| bool | auto_size_text | True if Elements in Window should be sized to exactly fir the length of text | | bool | auto_size_text | True if Elements in Window should be sized to exactly fir the length of text |
| bool | auto_size_buttons | True if Buttons in this Window should be sized to exactly fit the text on this. | | bool | auto_size_buttons | True if Buttons in this Window should be sized to exactly fit the text on this. |
| (int, int) | relative_location | (x,y) location relative to the CENTER of the window, in pixels. Normally the window centers. This location is relative to THAT centered location. Note they can be negative. |
| (int, int) | location | (x,y) location, in pixels, to locate the upper left corner of the window on the screen. Default is to center on screen. | | (int, int) | location | (x,y) location, in pixels, to locate the upper left corner of the window on the screen. Default is to center on screen. |
| (int, int) | size | (width, height) size in pixels for this window. Normally the window is autosized to fit contents, not set to an absolute size by the user. Try not to set this value. You risk, the contents being cut off, etc. Let the layout determine the window size instead | | (int, int) | size | (width, height) size in pixels for this window. Normally the window is autosized to fit contents, not set to an absolute size by the user. Try not to set this value. You risk, the contents being cut off, etc. Let the layout determine the window size instead |
| (int, int or (int, int),(int,int)) or int | element_padding | Default amount of padding to put around elements in window (left/right, top/bottom) or ((left, right), (top, bottom)), or an int. If an int, then it's converted into a tuple (int, int) | | (int, int or (int, int),(int,int)) or int | element_padding | Default amount of padding to put around elements in window (left/right, top/bottom) or ((left, right), (top, bottom)), or an int. If an int, then it's converted into a tuple (int, int) |

View File

@ -9259,6 +9259,14 @@ Column Element allow None for 1 size direction
* `FILE_TYPES_ALL_FILES` is a new constant with this value * `FILE_TYPES_ALL_FILES` is a new constant with this value
* `popup_scrolled` added 1 line per argument to fit the contents better in some cases * `popup_scrolled` added 1 line per argument to fit the contents better in some cases
## 4.51.0 PySimpleGUI 18-Oct-2021
`relative_location` parameter for `Window`
* New parameter for `Window` - `relative_location`
* Locates the window at an **offset** from the normal location
* Very useful for multi-window applications
* Also works when you've set a default window location using the `set_options` call.
## Code Condition ## Code Condition
Make it run Make it run

View File

@ -2226,6 +2226,14 @@ Column Element allow None for 1 size direction
* `popup_scrolled` added 1 line per argument to fit the contents better in some cases * `popup_scrolled` added 1 line per argument to fit the contents better in some cases
## 4.51.0 PySimpleGUI 18-Oct-2021
`relative_location` parameter for `Window`
* New parameter for `Window` - `relative_location`
* Locates the window at an **offset** from the normal location
* Very useful for multi-window applications
* Also works when you've set a default window location using the `set_options` call.
## Code Condition ## Code Condition
Make it run Make it run

View File

@ -11363,6 +11363,7 @@ Window(title,
auto_size_text = None, auto_size_text = None,
auto_size_buttons = None, auto_size_buttons = None,
location = (None, None), location = (None, None),
relative_location = (None, None),
size = (None, None), size = (None, None),
element_padding = None, element_padding = None,
margins = (None, None), margins = (None, None),
@ -11418,6 +11419,7 @@ Parameter Descriptions:
| (int, int) | default_button_element_size | (width, height) size in characters (wide) and rows (high) for all Button elements in this window | | (int, int) | default_button_element_size | (width, height) size in characters (wide) and rows (high) for all Button elements in this window |
| bool | auto_size_text | True if Elements in Window should be sized to exactly fir the length of text | | bool | auto_size_text | True if Elements in Window should be sized to exactly fir the length of text |
| bool | auto_size_buttons | True if Buttons in this Window should be sized to exactly fit the text on this. | | bool | auto_size_buttons | True if Buttons in this Window should be sized to exactly fit the text on this. |
| (int, int) | relative_location | (x,y) location relative to the CENTER of the window, in pixels. Normally the window centers. This location is relative to THAT centered location. Note they can be negative. |
| (int, int) | location | (x,y) location, in pixels, to locate the upper left corner of the window on the screen. Default is to center on screen. | | (int, int) | location | (x,y) location, in pixels, to locate the upper left corner of the window on the screen. Default is to center on screen. |
| (int, int) | size | (width, height) size in pixels for this window. Normally the window is autosized to fit contents, not set to an absolute size by the user. Try not to set this value. You risk, the contents being cut off, etc. Let the layout determine the window size instead | | (int, int) | size | (width, height) size in pixels for this window. Normally the window is autosized to fit contents, not set to an absolute size by the user. Try not to set this value. You risk, the contents being cut off, etc. Let the layout determine the window size instead |
| (int, int or (int, int),(int,int)) or int | element_padding | Default amount of padding to put around elements in window (left/right, top/bottom) or ((left, right), (top, bottom)), or an int. If an int, then it's converted into a tuple (int, int) | | (int, int or (int, int),(int,int)) or int | element_padding | Default amount of padding to put around elements in window (left/right, top/bottom) or ((left, right), (top, bottom)), or an int. If an int, then it's converted into a tuple (int, int) |

View File

@ -9259,6 +9259,14 @@ Column Element allow None for 1 size direction
* `FILE_TYPES_ALL_FILES` is a new constant with this value * `FILE_TYPES_ALL_FILES` is a new constant with this value
* `popup_scrolled` added 1 line per argument to fit the contents better in some cases * `popup_scrolled` added 1 line per argument to fit the contents better in some cases
## 4.51.0 PySimpleGUI 18-Oct-2021
`relative_location` parameter for `Window`
* New parameter for `Window` - `relative_location`
* Locates the window at an **offset** from the normal location
* Very useful for multi-window applications
* Also works when you've set a default window location using the `set_options` call.
## Code Condition ## Code Condition
Make it run Make it run