Merge pull request #4862 from PySimpleGUI/Dev-latest
Added scaling parameter to Window and to set_options
This commit is contained in:
commit
1d2278901d
|
@ -26,7 +26,7 @@ _change_log = """
|
|||
FIXED setting a size on Frame Elements. It's not worked previously, but THINK it does now! (insert fingers crossed emoji here)
|
||||
4.51.6.4
|
||||
Added dpi_awareness option to set_options as an experiment
|
||||
Added scaling parameter to Window
|
||||
Added scaling parameter to Window and to set_options for global scaling
|
||||
"""
|
||||
|
||||
__version__ = version.split()[0] # For PEP 396 and PEP 345
|
||||
|
@ -428,6 +428,7 @@ MAX_SCROLLED_TEXT_BOX_HEIGHT = 50
|
|||
DEFAULT_TOOLTIP_TIME = 400
|
||||
DEFAULT_TOOLTIP_OFFSET = (0, -20)
|
||||
DEFAULT_KEEP_ON_TOP = None
|
||||
DEFAULT_SCALING = None
|
||||
TOOLTIP_BACKGROUND_COLOR = "#ffffe0"
|
||||
TOOLTIP_FONT = None
|
||||
#################### COLOR STUFF ####################
|
||||
|
@ -8474,7 +8475,7 @@ class Window:
|
|||
:type titlebar_icon: (bytes | str)
|
||||
:param use_custom_titlebar: If True, then a custom titlebar will be used instead of the normal titlebar
|
||||
:type use_custom_titlebar: bool
|
||||
:param scaling: Apply scaling to the elements in the window. Normally not set at all.
|
||||
:param scaling: Apply scaling to the elements in the window. Can be set on a global basis using set_options
|
||||
:type scaling: float
|
||||
:param metadata: User metadata that can be set to ANYTHING
|
||||
:type metadata: (Any)
|
||||
|
@ -8600,7 +8601,7 @@ class Window:
|
|||
self._grab_anywhere_include_these_list = []
|
||||
self._has_custom_titlebar = use_custom_titlebar
|
||||
self._mousex = self._mousey = 0
|
||||
self.scaling = scaling
|
||||
self.scaling = scaling if scaling is not None else DEFAULT_SCALING
|
||||
if self.use_custom_titlebar:
|
||||
self.Margins = (0, 0)
|
||||
self.NoTitleBar = True
|
||||
|
@ -16128,7 +16129,7 @@ def set_options(icon=None, button_color=None, element_size=(None, None), button_
|
|||
window_location=(None, None), error_button_color=(None, None), tooltip_time=None, tooltip_font=None, use_ttk_buttons=None, ttk_theme=None,
|
||||
suppress_error_popups=None, suppress_raise_key_errors=None, suppress_key_guessing=None,warn_button_key_duplicates=False, enable_treeview_869_patch=None,
|
||||
enable_mac_notitlebar_patch=None, use_custom_titlebar=None, titlebar_background_color=None, titlebar_text_color=None, titlebar_font=None,
|
||||
titlebar_icon=None, user_settings_path=None, pysimplegui_settings_path=None, pysimplegui_settings_filename=None, keep_on_top=None, dpi_awareness=None):
|
||||
titlebar_icon=None, user_settings_path=None, pysimplegui_settings_path=None, pysimplegui_settings_filename=None, keep_on_top=None, dpi_awareness=None, scaling=None):
|
||||
"""
|
||||
:param icon: Can be either a filename or Base64 value. For Windows if filename, it MUST be ICO format. For Linux, must NOT be ICO. Most portable is to use a Base64 of a PNG file. This works universally across all OS's
|
||||
:type icon: bytes | str
|
||||
|
@ -16234,6 +16235,8 @@ def set_options(icon=None, button_color=None, element_size=(None, None), button_
|
|||
:type keep_on_top: (bool)
|
||||
:param dpi_awareness: If True then will turn on DPI awareness (Windows only at the moment)
|
||||
:type dpi_awareness: (bool)
|
||||
:param scaling: Sets the default scaling for all windows including popups, etc.
|
||||
:type scaling: (float)
|
||||
:return: None
|
||||
:rtype: None
|
||||
"""
|
||||
|
@ -16288,6 +16291,7 @@ def set_options(icon=None, button_color=None, element_size=(None, None), button_
|
|||
global DEFAULT_USER_SETTINGS_PYSIMPLEGUI_PATH
|
||||
global DEFAULT_USER_SETTINGS_PYSIMPLEGUI_FILENAME
|
||||
global DEFAULT_KEEP_ON_TOP
|
||||
global DEFAULT_SCALING
|
||||
global _pysimplegui_user_settings
|
||||
# global _my_windows
|
||||
|
||||
|
@ -16460,6 +16464,8 @@ def set_options(icon=None, button_color=None, element_size=(None, None), button_
|
|||
elif platform.release() == "8" or platform.release() == "10":
|
||||
ctypes.windll.shcore.SetProcessDpiAwareness(1)
|
||||
|
||||
if scaling is not None:
|
||||
DEFAULT_SCALING = scaling
|
||||
|
||||
return True
|
||||
|
||||
|
|
Loading…
Reference in New Issue