diff --git a/PySimpleGUI.py b/PySimpleGUI.py index b250df60..30f9096a 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -3125,7 +3125,7 @@ class Window: except: self.TKrootDestroyed = True _my_windows.Decrement() - print('ROOT Destroyed') + # print('ROOT Destroyed') results = BuildResults(self, False, self) if results[0] != None and results[0] != timeout_key: return results @@ -3136,7 +3136,7 @@ class Window: # print("** REALTIME PROBLEM FOUND **", results) if self.RootNeedsDestroying: - print('*** DESTROYING really late***') + # print('*** DESTROYING really late***') self.TKroot.destroy() # _my_windows.Decrement() self.LastButtonClicked = None @@ -3191,7 +3191,8 @@ class Window: self.TKroot.quit() self.TKroot.destroy() except: - print('DESTROY FAILED') + pass + # print('DESTROY FAILED') return None, None if not self.Shown: self.Show(non_blocking=True) @@ -3200,10 +3201,10 @@ class Window: except: self.TKrootDestroyed = True _my_windows.Decrement() - print("read failed") + # print("read failed") # return None, None if self.RootNeedsDestroying: - print('*** DESTROYING LATE ***', self.ReturnValues) + # print('*** DESTROYING LATE ***', self.ReturnValues) self.TKroot.destroy() _my_windows.Decrement() self.Values = None @@ -3864,8 +3865,7 @@ def BuildResultsForSubform(form, initialize_only, top_level_form): value = element.ClickPosition elif element.Type == ELEM_TYPE_MENUBAR: if element.MenuItemChosen is not None: - top_level_form.LastButtonClicked = element.MenuItemChosen - button_pressed_text = top_level_form.LastButtonClicked + button_pressed_text = top_level_form.LastButtonClicked = element.MenuItemChosen value = element.MenuItemChosen element.MenuItemChosen = None else: diff --git a/PySimpleGUIQt/PySimpleGUIQt.py b/PySimpleGUIQt/PySimpleGUIQt.py index a33709b9..e531620e 100644 --- a/PySimpleGUIQt/PySimpleGUIQt.py +++ b/PySimpleGUIQt/PySimpleGUIQt.py @@ -466,6 +466,20 @@ class Element(): if self.ParentForm.CurrentlyRunningMainloop: self.ParentForm.TKroot.quit() + + def Update(self, widget, background_color=None, text_color=None, font=None): + style = str(widget.styleSheet()) + if font is not None: + style = create_style_from_font(font) + if text_color is not None: + style += 'color: %s;' % text_color + if background_color is not None: + style += 'background-color: %s;' % background_color + # print(style) + widget.setStyleSheet(style) + + + def __del__(self): try: self.TKStringVar.__del__() @@ -539,7 +553,7 @@ class InputText(Element): self.ReturnKeyHandler(None) return - def Update(self, value=None, disabled=None, select=None): + def Update(self, value=None, disabled=None, select=None, background_color=None, text_color=None, font=None): if disabled is True: self.QT_QLineEdit.setDisabled(True) elif disabled is False: @@ -549,6 +563,9 @@ class InputText(Element): self.DefaultText = value if select: self.QT_QLineEdit.setSelection(0,QtGui.QTextCursor.End ) + super().Update(self.QT_QLineEdit, background_color=background_color, text_color=text_color, font=font) + + def Get(self): return self.QT_QLineEdit.text() @@ -2850,7 +2867,7 @@ class SystemTray: elif messageicon is not None: self.TrayIcon.showMessage(title, message, messageicon, time) else: - self.TrayIcon.showMessage(title, message) + self.TrayIcon.showMessage(title, message, time) return self @@ -2915,13 +2932,15 @@ class Window: alpha_channel=1, return_keyboard_events=False, use_default_focus=True, text_justification=None, no_titlebar=False, grab_anywhere=False, keep_on_top=False, resizable=False, disable_close=False, background_image=None): ''' - Window + :param title: :param default_element_size: :param default_button_element_size: :param auto_size_text: :param auto_size_buttons: :param location: + :param size: + :param element_padding: :param button_color: :param font: :param progress_bar_color: @@ -2931,6 +2950,7 @@ class Window: :param auto_close_duration: :param icon: :param force_toplevel: + :param alpha_channel: :param return_keyboard_events: :param use_default_focus: :param text_justification: @@ -2938,6 +2958,8 @@ class Window: :param grab_anywhere: :param keep_on_top: :param resizable: + :param disable_close: + :param background_image: ''' self.AutoSizeText = auto_size_text if auto_size_text is not None else DEFAULT_AUTOSIZE_TEXT self.AutoSizeButtons = auto_size_buttons if auto_size_buttons is not None else DEFAULT_AUTOSIZE_BUTTONS