Merge pull request #4293 from PySimpleGUI/Dev-latest

New Sizegrip Element. FIX for grab_anywhere! Now sliders, scrollbars,…
This commit is contained in:
PySimpleGUI 2021-05-19 14:00:27 -04:00 committed by GitHub
commit 4894adb70e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 78 additions and 11 deletions

View File

@ -1,5 +1,6 @@
#!/usr/bin/python3 #!/usr/bin/python3
version = __version__ = "4.41.2.1 Unreleased\nFix for getting wrong tab number in Tab.update, added bind_return_key to Combo Element"
version = __version__ = "4.41.2.2 Unreleased\nFix for getting wrong tab number in Tab.update, added bind_return_key to Combo Element, new Sizegrip element, fixed grab_anywhere so that it doesn't grab multiline slider scrollbars input and a few other elements"
__version__ = version.split()[0] # For PEP 396 and PEP 345 __version__ = version.split()[0] # For PEP 396 and PEP 345
@ -337,6 +338,8 @@ DEFAULT_BASE64_LOADING_GIF = b'R0lGODlhQABAAKUAAAQCBJyenERCRNTS1CQiJGRmZLS2tPTy9
PSG_DEBUGGER_LOGO = b'iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAALiIAAC4iAari3ZIAAA2CSURBVHhe7VtplBXFGe03qBiN+RGJJjEGFGZYXWMETDhhZFEGDaA4KCbnmOTo0UQx7AwgMIDs+4ggGlAjI/BERxY3loggHpGdgRkGJlFQzxFzNCd6NC6hc28tXVXd/XrevBnyI/HC7ar6vuru735V1a9f9xvvG/yfI6XKBuO+QYN/hKIT+H1h8Lz3wG1lC+Z+KJu5obDrtc1QtAVPB98Ha/7y6uaTKBsFDUoARHP/m8BhYEcwfLyvwTQ4Gol4W1iyBIRfhmIa2ANsQpvCR+Cz4EIkYq+wNAA5JwDiL0TxJNhVGJLxMdgPSdgim8mA+GIUPHZTYYiHDz4PjkAijghLDsgpARDfC8VT4HeFITt8DvZBEjbIZjyU+OXgacJQN/4FcqZMRSK+FJZ6oF4JUFN+JD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VIPHPsl2cyMOpeAjRdfeuV8BM6Hpd2kxUVdUx892Ec8xirqdb3z0qJl8xbqhWyDlwN/CXoTxEeu+HGoVwKIl1/ZyFkzBJyIZIg/SMj2mqDF97q+Z+wbmwYmgT/tKwNLID7j3weEUe8EaGzYuLkAxSLwWmEIIZwULf66nt0TX1flmAQ+5BwE4fy4qxdyTgCxcRP/MCnF9YvbZ+8S2qKTgdNe/Pb31z26X+vchmaCSgLfmw0Qhsw4BPJP5sohPqc/uWlQAjQ2bX6Vx/kZktAPYq9G/VyQqTiCAvf/3lPduxVmPS0JJIFFT/AekMf8AciPNa7tbSBnyVYIT15//ytAQlKkan6DxoHn/QdmVLZzVZokoAAAAABJRU5ErkJggg=='
SIZE_GRIP_BASE64 = b'iVBORw0KGgoAAAANSUhEUgAAAA4AAAAOCAYAAAAfSC3RAAAAI0lEQVR4nGNgGHbgPxTDAdMAOQQ7QHbeIHQqLucNQqfSHgAAGFsL+26GGtQAAAAASUVORK5CYII='
DEFAULT_WINDOW_ICON = DEFAULT_BASE64_ICON DEFAULT_WINDOW_ICON = DEFAULT_BASE64_ICON
@ -473,6 +476,10 @@ TEXT_LOCATION_BOTTOM_LEFT = tk.SW
TEXT_LOCATION_BOTTOM_RIGHT = tk.SE TEXT_LOCATION_BOTTOM_RIGHT = tk.SE
TEXT_LOCATION_CENTER = tk.CENTER TEXT_LOCATION_CENTER = tk.CENTER
GRAB_ANYWHERE_IGNORE_THESE_WIDGETS = (ttk.Sizegrip, tk.Scale, ttk.Scrollbar, tk.scrolledtext.ScrolledText, tk.Scrollbar, tk.Entry, tk.Text)
# ----====----====----==== Constants the user should NOT f-with ====----====----====----# # ----====----====----==== Constants the user should NOT f-with ====----====----====----#
ThisRow = 555666777 # magic number ThisRow = 555666777 # magic number
@ -638,6 +645,7 @@ ELEM_TYPE_STATUSBAR = 'statusbar'
ELEM_TYPE_PANE = 'pane' ELEM_TYPE_PANE = 'pane'
ELEM_TYPE_BUTTONMENU = 'buttonmenu' ELEM_TYPE_BUTTONMENU = 'buttonmenu'
ELEM_TYPE_TITLEBAR = 'titlebar' ELEM_TYPE_TITLEBAR = 'titlebar'
ELEM_TYPE_SIZEGRIP = 'sizegrip'
# STRETCH == ERROR ELEMENT as a filler # STRETCH == ERROR ELEMENT as a filler
@ -5619,6 +5627,28 @@ HSep = HorizontalSeparator
# ---------------------------------------------------------------------- #
# Sizegrip #
# ---------------------------------------------------------------------- #
class Sizegrip(Element):
"""
Sizegrip
"""
def __init__(self, background_color=None,):
"""
"""
bg = background_color if background_color is not None else theme_background_color()
super().__init__(ELEM_TYPE_SIZEGRIP, background_color=bg)
SGrip = Sizegrip
# ---------------------------------------------------------------------- # # ---------------------------------------------------------------------- #
# Tab # # Tab #
@ -7887,7 +7917,6 @@ Normally a tuple, but can be a simplified-dual-color-string "foreground on backg
self.right_click_menu_selected_colors = _simplified_dual_color_to_tuple(right_click_menu_selected_colors, (self.right_click_menu_background_color, self.right_click_menu_text_color)) self.right_click_menu_selected_colors = _simplified_dual_color_to_tuple(right_click_menu_selected_colors, (self.right_click_menu_background_color, self.right_click_menu_text_color))
if self.use_custom_titlebar: if self.use_custom_titlebar:
self.Margins = (0,0) self.Margins = (0,0)
self.NoTitleBar = True self.NoTitleBar = True
@ -8907,12 +8936,16 @@ Normally a tuple, but can be a simplified-dual-color-string "foreground on backg
:param event: event information passed in by tkinter. Contains x,y position of mouse :param event: event information passed in by tkinter. Contains x,y position of mouse
:type event: (event) :type event: (event)
""" """
if isinstance(event.widget, GRAB_ANYWHERE_IGNORE_THESE_WIDGETS):
# print('Found widget to ignore in grab anywhere...')
return
try: try:
self.TKroot.x = event.x self.TKroot.x = event.x
self.TKroot.y = event.y self.TKroot.y = event.y
except: except:
pass pass
# print('Start move {},{}'.format(event.x,event.y)) # print('Start move {},{} widget {}'.format(event.x,event.y, event.widget))
def _StopMove(self, event): def _StopMove(self, event):
""" """
@ -8921,6 +8954,9 @@ Normally a tuple, but can be a simplified-dual-color-string "foreground on backg
:param event: event information passed in by tkinter. Contains x,y position of mouse :param event: event information passed in by tkinter. Contains x,y position of mouse
:type event: (event) :type event: (event)
""" """
if isinstance(event.widget, GRAB_ANYWHERE_IGNORE_THESE_WIDGETS):
# print('Found widget to ignore in grab anywhere...')
return
try: try:
self.TKroot.x = event.x self.TKroot.x = event.x
@ -8935,6 +8971,10 @@ Normally a tuple, but can be a simplified-dual-color-string "foreground on backg
:param event: event information passed in by tkinter. Contains x,y position of mouse :param event: event information passed in by tkinter. Contains x,y position of mouse
:type event: (event) :type event: (event)
""" """
if isinstance(event.widget, GRAB_ANYWHERE_IGNORE_THESE_WIDGETS):
# print('Found widget to ignore in grab anywhere...')
return
try: try:
deltax = event.x - self.TKroot.x deltax = event.x - self.TKroot.x
deltay = event.y - self.TKroot.y deltay = event.y - self.TKroot.y
@ -12253,6 +12293,8 @@ def PackFormIntoFrame(form, containing_frame, toplevel_form):
tclversion_detailed = tkinter.Tcl().eval('info patchlevel') tclversion_detailed = tkinter.Tcl().eval('info patchlevel')
size_grip = None
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# **************** Use FlexForm to build the tkinter window ********** ----- # # **************** Use FlexForm to build the tkinter window ********** ----- #
# Building is done row by row. # # Building is done row by row. #
@ -13261,8 +13303,7 @@ def PackFormIntoFrame(form, containing_frame, toplevel_form):
if element.Disabled is True: # note overrides readonly if disabled if element.Disabled is True: # note overrides readonly if disabled
element.TKSpinBox['state'] = 'disabled' element.TKSpinBox['state'] = 'disabled'
if element.Tooltip is not None: if element.Tooltip is not None:
element.TooltipObject = ToolTip(element.TKSpinBox, text=element.Tooltip, element.TooltipObject = ToolTip(element.TKSpinBox, text=element.Tooltip, timeout=DEFAULT_TOOLTIP_TIME)
timeout=DEFAULT_TOOLTIP_TIME)
# ------------------------- OUTPUT placement element ------------------------- # # ------------------------- OUTPUT placement element ------------------------- #
elif element_type == ELEM_TYPE_OUTPUT: elif element_type == ELEM_TYPE_OUTPUT:
element = element # type: Output element = element # type: Output
@ -13836,6 +13877,27 @@ def PackFormIntoFrame(form, containing_frame, toplevel_form):
else: else:
separator.pack(side=tk.LEFT, padx=elementpad[0], pady=elementpad[1], fill=tk.Y, expand=True) separator.pack(side=tk.LEFT, padx=elementpad[0], pady=elementpad[1], fill=tk.Y, expand=True)
element.Widget.configure(style=style_name) # IMPORTANT! Apply the style element.Widget.configure(style=style_name) # IMPORTANT! Apply the style
# ------------------------- SizeGrip placement element ------------------------- #
elif element_type == ELEM_TYPE_SIZEGRIP:
element = element # type: Sizegrip
style_name = "Sizegrip"
style = ttk.Style()
style.theme_use(toplevel_form.TtkTheme)
image = tk.PhotoImage(data=SIZE_GRIP_BASE64)
settings = dict()
settings.update({
'Sizegrip.sizegrip': {
'element create': ('image', image)},
'TSizegrip': {
'configure': {'background': element.BackgroundColor if element.BackgroundColor != COLOR_SYSTEM_DEFAULT else None},
'layout': [('Sizegrip.sizegrip', {'side': 'bottom', 'sticky': 'se'})]}})
style.theme_settings(toplevel_form.TtkTheme, settings=settings)
size_grip = element.Widget = ttk.Sizegrip(containing_frame)
size_grip.image = image
toplevel_form.sizegrip_widget = size_grip
# ------------------------- StatusBar placement element ------------------------- # # ------------------------- StatusBar placement element ------------------------- #
elif element_type == ELEM_TYPE_STATUSBAR: elif element_type == ELEM_TYPE_STATUSBAR:
# auto_size_text = element.AutoSizeText # auto_size_text = element.AutoSizeText
@ -13931,6 +13993,9 @@ def PackFormIntoFrame(form, containing_frame, toplevel_form):
expand=row_should_expand, fill=row_fill_direction) expand=row_should_expand, fill=row_fill_direction)
if form.BackgroundColor is not None and form.BackgroundColor != COLOR_SYSTEM_DEFAULT: if form.BackgroundColor is not None and form.BackgroundColor != COLOR_SYSTEM_DEFAULT:
tk_row_frame.configure(background=form.BackgroundColor) tk_row_frame.configure(background=form.BackgroundColor)
if size_grip:
size_grip.pack(side=tk.BOTTOM, anchor='se', padx=0, pady=0)
return return
@ -14052,12 +14117,6 @@ def StartupTK(window):
window._create_thread_queue() window._create_thread_queue()
# Make moveable window
if (window.GrabAnywhere is not False and not (
window.NonBlocking and window.GrabAnywhere is not True)):
root.bind("<ButtonPress-1>", window._StartMove)
root.bind("<ButtonRelease-1>", window._StopMove)
root.bind("<B1-Motion>", window._OnMotion)
if not window.Resizable: if not window.Resizable:
root.resizable(False, False) root.resizable(False, False)
@ -14075,6 +14134,14 @@ def StartupTK(window):
# root.bind('<Destroy>', MyFlexForm.DestroyedCallback()) # root.bind('<Destroy>', MyFlexForm.DestroyedCallback())
_convert_window_to_tk(window) _convert_window_to_tk(window)
# Make moveable window
if (window.GrabAnywhere is not False and not (
window.NonBlocking and window.GrabAnywhere is not True)):
root.bind("<ButtonPress-1>", window._StartMove)
root.bind("<ButtonRelease-1>", window._StopMove)
root.bind("<B1-Motion>", window._OnMotion)
window.SetIcon(window.WindowIcon) window.SetIcon(window.WindowIcon)
try: try: