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:
		
						commit
						5633590c32
					
				
					 1 changed files with 8 additions and 2 deletions
				
			
		|  | @ -2013,7 +2013,7 @@ class Window: | ||||||
|     ''' |     ''' | ||||||
|     Display a user defined for and return the filled in data |     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.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.AutoSizeButtons = auto_size_buttons if auto_size_buttons is not None else DEFAULT_AUTOSIZE_BUTTONS | ||||||
|         self.Title = title |         self.Title = title | ||||||
|  | @ -2054,6 +2054,7 @@ class Window: | ||||||
|         self.NoTitleBar = no_titlebar |         self.NoTitleBar = no_titlebar | ||||||
|         self.GrabAnywhere = grab_anywhere |         self.GrabAnywhere = grab_anywhere | ||||||
|         self.KeepOnTop = keep_on_top |         self.KeepOnTop = keep_on_top | ||||||
|  |         self.ForceTopLevel = force_toplevel | ||||||
| 
 | 
 | ||||||
|     # ------------------------- Add ONE Row to Form ------------------------- # |     # ------------------------- Add ONE Row to Form ------------------------- # | ||||||
|     def AddRow(self, *args): |     def AddRow(self, *args): | ||||||
|  | @ -3471,8 +3472,13 @@ def StartupTK(my_flex_form): | ||||||
|     global _my_windows |     global _my_windows | ||||||
| 
 | 
 | ||||||
|     ow = _my_windows.NumOpenWindows |     ow = _my_windows.NumOpenWindows | ||||||
|  | 
 | ||||||
|     # print('Starting TK open Windows = {}'.format(ow)) |     # 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: |     try: | ||||||
|         root.attributes('-alpha', 0)             # hide window while building it. makes for smoother 'paint' |         root.attributes('-alpha', 0)             # hide window while building it. makes for smoother 'paint' | ||||||
|     except: |     except: | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue