Fix for missing slider results, ChangeLookAndFeel feature

This commit is contained in:
MikeTheWatchGuy 2018-08-11 19:29:38 -04:00
parent a4e3457415
commit 86f2f60120
1 changed files with 41 additions and 5 deletions

View File

@ -1266,9 +1266,11 @@ def BuildResults(form):
value = 0
results[row_num][col_num] = value
input_values.append(value)
try:
if element.Key is None:
input_values_dictionary[key_counter] = value
key_counter +=1
else:
input_values_dictionary[element.Key] = value
except: pass
elif element.Type == ELEM_TYPE_INPUT_MULTILINE:
try:
value=element.TKText.get(1.0, tk.END)
@ -2451,6 +2453,40 @@ def SetOptions(icon=None, button_color=None, element_size=(None,None), margins=(
return True
#################### ChangeLookAndFeel #######################
# Predefined settings that will change the colors and styles #
# of the elements. #
##############################################################
def ChangeLookAndFeel(index):
# look and feel table
look_and_feel = {'GreenTan': {'BACKGROUND' : '#9FB8AD', 'TEXT': COLOR_SYSTEM_DEFAULT, 'INPUT':'#F7F3EC', 'BUTTON': ('white', '#475841'),
'PROGRESS':DEFAULT_PROGRESS_BAR_COLOR},
'LightGreen' :{'BACKGROUND' : '#B7CECE', 'TEXT': 'black', 'INPUT':'#FDFFF7', 'BUTTON': ('white', '#658268'), 'PROGRESS':('#247BA0','#F8FAF0')},
'BluePurple': {'BACKGROUND' : '#A5CADD', 'TEXT': '#6E266E', 'INPUT':'#E0F5FF', 'BUTTON': ('white', '#303952'),'PROGRESS':DEFAULT_PROGRESS_BAR_COLOR}}
try:
colors = look_and_feel[index]
SetOptions(background_color=colors['BACKGROUND'],
text_element_background_color=colors['BACKGROUND'],
element_background_color=colors['BACKGROUND'],
text_color=colors['TEXT'],
input_elements_background_color=colors['INPUT'],
button_color=colors['BUTTON'],
progress_meter_color=colors['PROGRESS'],
border_width=0,
slider_border_width=0,
progress_meter_border_depth=0,
scrollbar_color=(colors['INPUT']),
element_text_color=colors['TEXT'])
except: # most likely an index out of range
pass
# ============================== sprint ======#
# Is identical to the Scrolled Text Box #
# Provides a crude 'print' mechanism but in a #
@ -2472,12 +2508,12 @@ def ObjToString(obj, extra=' '):
def main():
with FlexForm('Demo form..', auto_size_text=True) as form:
with FlexForm('Demo form..') as form:
form_rows = [[Text('You are running the PySimpleGUI.py file itself')],
[Text('You should be importing it rather than running it\n')],
[Text('Here is your sample input form....')],
[Text('Source Folder', size=(15, 1), auto_size_text=False, justification='right'), InputText('Source', focus=True),FolderBrowse()],
[Text('Destination Folder', size=(15, 1), auto_size_text=False, justification='right'), InputText('Dest'), FolderBrowse()],
[Text('Source Folder', size=(15, 1), justification='right'), InputText('Source', focus=True),FolderBrowse()],
[Text('Destination Folder', size=(15, 1), justification='right'), InputText('Dest'), FolderBrowse()],
[Submit(bind_return_key=True), Cancel()]]
button, (source, dest) = form.LayoutAndRead(form_rows)