11#!/usr/bin/python3
2- version = __version__ = "4.57.0.3 Unreleased"
2+ version = __version__ = "4.57.0.4 Unreleased"
33
44_change_log = """
55 Changelog since 4.57.0 released to PyPI on 13-Feb-2022
1010 Added cast to bool of default parm for Checkbox element in case user passes in an incorrect type
1111 4.57.0.3
1212 Coupon... for 30 days this time....
13+ 4.57.0.4
14+ ButtonMenu.update - addition of button_text parameter. Enables changing text displayed on the ButtonMenu. Should have been an original feature.
1315 """
1416
1517__version__ = version.split()[0] # For PEP 396 and PEP 345
@@ -4827,7 +4829,7 @@ def _MenuItemChosenCallback(self, item_chosen): # ButtonMenu Menu Item Chosen C
48274829 # self.ParentForm.TKroot.quit() # kick the users out of the mainloop
48284830 _exit_mainloop(self.ParentForm)
48294831
4830- def update(self, menu_definition=None, visible=None, image_source=None, image_size=(None, None), image_subsample=None):
4832+ def update(self, menu_definition=None, visible=None, image_source=None, image_size=(None, None), image_subsample=None, button_text=None ):
48314833 """
48324834 Changes some of the settings for the ButtonMenu Element. Must call `Window.Read` or `Window.Finalize` prior
48334835
@@ -4847,6 +4849,8 @@ def update(self, menu_definition=None, visible=None, image_source=None, image_si
48474849 :type image_size: (int, int)
48484850 :param image_subsample: amount to reduce the size of the image. Divides the size by this number. 2=1/2, 3=1/3, 4=1/4, etc
48494851 :type image_subsample: (int)
4852+ :param button_text: Text to be shown on the button
4853+ :type button_text: (str)
48504854 """
48514855
48524856 if not self._widget_was_created(): # if widget hasn't been created yet, then don't allow
@@ -4897,7 +4901,9 @@ def update(self, menu_definition=None, visible=None, image_source=None, image_si
48974901
48984902 self.TKButtonMenu.config(image=image, compound=tk.CENTER, width=width, height=height)
48994903 self.TKButtonMenu.image = image
4900-
4904+ if button_text is not None:
4905+ self.TKButtonMenu.configure(text=button_text)
4906+ self.ButtonText = button_text
49014907 if visible is False:
49024908 self.TKButtonMenu.pack_forget()
49034909 elif visible is True:
@@ -23490,7 +23496,8 @@ def main():
2349023496 # webbrowser.open_new_tab(r'https://udemy.com/PySimpleGUI')
2349123497 webbrowser.open_new_tab(r'https://www.buymeacoffee.com/PySimpleGUI')
2349223498 elif event in ('-EMOJI-HEARTS-', '-HEART-'):
23493- popup_scrolled("Oh look! It's a Udemy discsount coupon!", '0D50D92ADEDA243A4A4B')
23499+ popup_scrolled("Oh look! It's a Udemy discount coupon!", '0D50D92ADEDA243A4A4B',
23500+ 'A personal message from Mike -- thank you so very much for supporting PySimpleGUI!', title='Udemy Coupon', image=EMOJI_BASE64_MIKE)
2349423501
2349523502 elif event == 'Themes':
2349623503 search_string = popup_get_text('Enter a search term or leave blank for all themes', 'Show Available Themes', keep_on_top=True)
0 commit comments