Fix for Tabbed Forms - ReadButton was returing None values. Also fixed problem with blank popups after tabbed form.
This commit is contained in:
parent
5f29697887
commit
8eadf8e21d
|
@ -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()]
|
||||
]
|
||||
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue