Merge pull request #363 from MikeTheWatchGuy/Dev-latest

New Window option - Force top level - forces the window to be a Tople…
This commit is contained in:
MikeTheWatchGuy 2018-09-27 01:17:53 -04:00 committed by GitHub
commit 5633590c32
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 2 deletions

View File

@ -2013,7 +2013,7 @@ class Window:
'''
Display a user defined for and return the filled in data
'''
def __init__(self, title, default_element_size=DEFAULT_ELEMENT_SIZE, default_button_element_size = (None, None), auto_size_text=None, auto_size_buttons=None, location=(None, None), button_color=None, font=None, progress_bar_color=(None, None), background_color=None, is_tabbed_form=False, border_depth=None, auto_close=False, auto_close_duration=DEFAULT_AUTOCLOSE_TIME, icon=DEFAULT_WINDOW_ICON, return_keyboard_events=False, use_default_focus=True, text_justification=None, no_titlebar=False, grab_anywhere=False, keep_on_top=False):
def __init__(self, title, default_element_size=DEFAULT_ELEMENT_SIZE, default_button_element_size = (None, None), auto_size_text=None, auto_size_buttons=None, location=(None, None), button_color=None, font=None, progress_bar_color=(None, None), background_color=None, is_tabbed_form=False, border_depth=None, auto_close=False, auto_close_duration=DEFAULT_AUTOCLOSE_TIME, icon=DEFAULT_WINDOW_ICON, force_toplevel = False, return_keyboard_events=False, use_default_focus=True, text_justification=None, no_titlebar=False, grab_anywhere=False, keep_on_top=False):
self.AutoSizeText = auto_size_text if auto_size_text is not None else DEFAULT_AUTOSIZE_TEXT
self.AutoSizeButtons = auto_size_buttons if auto_size_buttons is not None else DEFAULT_AUTOSIZE_BUTTONS
self.Title = title
@ -2054,6 +2054,7 @@ class Window:
self.NoTitleBar = no_titlebar
self.GrabAnywhere = grab_anywhere
self.KeepOnTop = keep_on_top
self.ForceTopLevel = force_toplevel
# ------------------------- Add ONE Row to Form ------------------------- #
def AddRow(self, *args):
@ -3471,8 +3472,13 @@ def StartupTK(my_flex_form):
global _my_windows
ow = _my_windows.NumOpenWindows
# print('Starting TK open Windows = {}'.format(ow))
root = tk.Tk() if not ow else tk.Toplevel()
if not ow and not my_flex_form.ForceTopLevel:
root = tk.Tk()
else:
root = tk.Toplevel()
try:
root.attributes('-alpha', 0) # hide window while building it. makes for smoother 'paint'
except: