From 31b8f4258651beda00a33b18e63ef3f9716aa5b9 Mon Sep 17 00:00:00 2001 From: PySimpleGUI Date: Mon, 4 Nov 2019 14:56:39 -0500 Subject: [PATCH] Fix for BrowseFiles button, added range to Slider update --- PySimpleGUI.py | 7 +++++-- PySimpleGUIQt/PySimpleGUIQt.py | 10 +++++++--- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 60f0b55e..ac134e3b 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -741,6 +741,7 @@ class Element(): :param event: (unknown) Not used in this function. """ + # print(f'Button callback event = {obj_to_string_single_obj(event)}') try: self.ButtonCallBack() except: @@ -5153,7 +5154,6 @@ class Window: """ Represents a single Window """ - NumOpenWindows = 0 user_defined_icon = None hidden_master_root = None @@ -5285,6 +5285,7 @@ class Window: if finalize: self.Finalize() + @classmethod def GetAContainerNumber(cls): """ @@ -6070,7 +6071,8 @@ class Window: except: pass self.TKrootDestroyed = True - del self + del self.TKroot + del self.Rows # IT FINALLY WORKED! 29-Oct-2018 was the first time this damned thing got called @@ -7337,6 +7339,7 @@ def _BuildResultsForSubform(form, initialize_only, top_level_form): value = element.MenuItemChosen element.MenuItemChosen = None elif element.Type == ELEM_TYPE_BUTTONMENU: + print(f'Building results. Menu item chosen = {element.MenuItemChosen}') value = element.MenuItemChosen element.MenuItemChosen = None diff --git a/PySimpleGUIQt/PySimpleGUIQt.py b/PySimpleGUIQt/PySimpleGUIQt.py index 31cb44dc..4af3e8e1 100644 --- a/PySimpleGUIQt/PySimpleGUIQt.py +++ b/PySimpleGUIQt/PySimpleGUIQt.py @@ -1,5 +1,5 @@ #!/usr/bin/python3 -version = __version__ = "0.30.02 Unreleased Menu color Bye bye PyQt5, added 5 extra pixels to window size" +version = __version__ = "0.30.04 Unreleased Menu color Bye bye PyQt5, added 5 extra pixels to window size, FilesBrowse fix, Slider.Update range" import sys import types @@ -1328,7 +1328,7 @@ class Button(Element): if target_element.Type == ELEM_TYPE_BUTTON: target_element.FileOrFolderName = file_name else: - target_element.Update(file_name[0]) + target_element.Update(file_name) elif self.BType == BUTTON_TYPE_SAVEAS_FILE: qt_types = convert_tkinter_filetypes_to_qt(self.FileTypes) file_name = QFileDialog.getSaveFileName(dir=self.InitialFolder, filter=qt_types) @@ -1486,7 +1486,7 @@ class ButtonMenu(Element): def _QT_MenuItemChosenCallback(self, item_chosen): - print('IN BUTTON MENU ITEM CALLBACK', item_chosen) + # print('IN BUTTON MENU ITEM CALLBACK', item_chosen) self.Key = item_chosen.replace('&','') # fool the quit function into thinking this was a key _element_callback_quit_mainloop(self) @@ -2242,6 +2242,10 @@ class Slider(Element): self.QT_Slider.setDisabled(True) elif disabled == False: self.QT_Slider.setDisabled(False) + if range != (None, None): + self.Range = range + self.QT_Slider.setMinimum(range[0]) + self.QT_Slider.setMaximum(range[1]) super().Update(self.QT_Slider, visible=visible)