Merge pull request #299 from MikeTheWatchGuy/Dev-latest

Fix for Tabbed Forms - ReadButton was returing None values.  Also fix…
This commit is contained in:
MikeTheWatchGuy 2018-09-21 21:11:25 -04:00 committed by GitHub
commit e32bee449b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 2 deletions

View File

@ -23,7 +23,7 @@ layout = [
[sg.InputText('This is my text')],
[sg.Frame(layout=[
[sg.Checkbox('Checkbox', size=(10,1)), sg.Checkbox('My second checkbox!', default=True)],
[sg.Radio('My first Radio! ', "RADIO1", default=True, size=(10,1)), sg.Radio('My second Radio!', "RADIO1")]], title='Options',title_color='red', relief=sg.RELIEF_SUNKEN)],
[sg.Radio('My first Radio! ', "RADIO1", default=True, size=(10,1)), sg.Radio('My second Radio!', "RADIO1")]], title='Options',title_color='red', relief=sg.RELIEF_SUNKEN, tooltip='Use these to set flags')],
[sg.Multiline(default_text='This is the default Text should you decide not to type anything', size=(35, 3)),
sg.Multiline(default_text='A second multi-line', size=(35, 3))],
[sg.InputCombo(('Combobox 1', 'Combobox 2'), size=(20, 1)),
@ -39,7 +39,7 @@ layout = [
[sg.Text('Choose A Folder', size=(35, 1))],
[sg.Text('Your Folder', size=(15, 1), auto_size_text=False, justification='right'),
sg.InputText('Default Folder'), sg.FolderBrowse()],
[sg.Submit(), sg.Cancel()]
[sg.Submit(tooltip='Click to submit this form'), sg.Cancel()]
]

View File

@ -1084,6 +1084,8 @@ class Button(Element):
else:
self.ParentForm.LastButtonClicked = self.ButtonText
self.ParentForm.FormRemainedOpen = True
if self.ParentForm.IsTabbedForm:
self.ParentForm.UberParent.FormStayedOpen = True
self.ParentForm.TKroot.quit() # kick the users out of the mainloop
elif self.BType == BUTTON_TYPE_CLOSES_WIN_ONLY: # this is a return type button so GET RESULTS and destroy window
# if the form is tabbed, must collect all form's results and destroy all forms
@ -2147,6 +2149,7 @@ class UberForm():
self.FormReturnValues = []
self.TKroot = None
self.TKrootDestroyed = False
self.FormStayedOpen = False
def AddForm(self, form):
self.FormList.append(form)
@ -3131,6 +3134,8 @@ def ShowTabbedForm(title, *args, auto_close=False, auto_close_duration=DEFAULT_A
except:
pass
_my_windows.Increment()
if not len(args):
print('******************* SHOW TABBED FORMS ERROR .... no arguments')
return
@ -3184,6 +3189,14 @@ def ShowTabbedForm(title, *args, auto_close=False, auto_close_duration=DEFAULT_A
pass
root.mainloop()
if uber.FormStayedOpen:
FormReturnValues = []
for form in uber.FormList:
BuildResults(form, False, form)
FormReturnValues.append(form.ReturnValues)
uber.FormReturnValues = FormReturnValues
# if self.LastKeyboardEvent is not None or self.LastButtonClicked is not None:
# return BuildResults(self, False, self)
if id: root.after_cancel(id)
uber.TKrootDestroyed = True
return uber.FormReturnValues