Added theme_add_new, added Multiline write_only parm

This commit is contained in:
PySimpleGUI 2020-07-18 19:46:30 -04:00
parent 110e5a0daf
commit 2684d7834a
1 changed files with 22 additions and 2 deletions

View File

@ -1,5 +1,5 @@
#!/usr/bin/python3
version = __version__ = "0.17.1.4 Unreleased\n VSeparator added (spelling error), Radio.reset_group added and removed the clearing all when one cleared, added default key for one_line_progress_meter, auto-add keys to tables & trees"
version = __version__ = "0.17.1.5 Unreleased\n VSeparator added (spelling error), Radio.reset_group added and removed the clearing all when one cleared, added default key for one_line_progress_meter, auto-add keys to tables & trees, added theme_add_new"
port = 'PySimpleGUIWx'
@ -955,7 +955,7 @@ class Spin(Element):
class Multiline(Element):
def __init__(self, default_text='', enter_submits=False, disabled=False, autoscroll=False, size=(None, None),
auto_size_text=None, background_color=None, text_color=None, change_submits=False, enable_events=False, do_not_clear=True,
key=None, focus=False, font=None, pad=None, tooltip=None, visible=True, size_px=(None,None)):
key=None, write_only=False, focus=False, font=None, pad=None, tooltip=None, visible=True, size_px=(None,None)):
'''
Multiline Element
:param default_text:
@ -982,6 +982,7 @@ class Multiline(Element):
self.Autoscroll = autoscroll
self.Disabled = disabled
self.ChangeSubmits = change_submits or enable_events
self.WriteOnly = write_only
self.Widget = self.WxTextCtrl = None
@ -4001,6 +4002,8 @@ def BuildResultsForSubform(form, initialize_only, top_level_form):
except:
value = 0
elif element.Type == ELEM_TYPE_INPUT_MULTILINE:
if element.WriteOnly:
continue
try:
value = element.WxTextCtrl.GetValue()
except:
@ -7135,6 +7138,23 @@ def theme_list():
return list_of_look_and_feel_values()
def theme_add_new(new_theme_name, new_theme_dict):
"""
Add a new theme to the dictionary of themes
:param new_theme_name: text to display in element
:type new_theme_name: (str)
:param new_theme_dict: text to display in element
:type new_theme_dict: (dict)
"""
global LOOK_AND_FEEL_TABLE
try:
LOOK_AND_FEEL_TABLE[new_theme_name] = new_theme_dict
except Exception as e:
print('Exception during adding new theme {}'.format(e))
def theme_previewer(columns=12):
"""
Show a window with all of the color themes - takes a while so be patient