Merge pull request #1375 from PySimpleGUI/Dev-latest

Added back automatic key creation.  Changed FindElement to use new Ke…
This commit is contained in:
MikeTheWatchGuy 2019-05-04 18:10:05 -04:00 committed by GitHub
commit d704ba7f2c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 2 deletions

View File

@ -3909,7 +3909,11 @@ class Window:
return self
def FindElement(self, key, silent_on_error=False):
element = _FindElementFromKeyInSubForm(self, key)
try:
element = self.AllKeysDict[key]
except KeyError:
element = None
# element = _FindElementFromKeyInSubForm(self, key)
if element is None:
if not silent_on_error:
print('*** WARNING = FindElement did not find the key. Please check your key\'s spelling ***')
@ -4420,7 +4424,7 @@ def ColorChooserButton(button_text, target=(None, None), image_filename=None, im
def AddToReturnDictionary(form, element, value):
if element.Key is None:
form.ReturnValuesDictionary[form.DictionaryKeyCounter] = value
# element.Key = form.DictionaryKeyCounter
element.Key = form.DictionaryKeyCounter
form.DictionaryKeyCounter += 1
else:
form.ReturnValuesDictionary[element.Key] = value