Merge pull request #163 from MikeTheWatchGuy/Dev-latest
New feature - keep_on_top setting in FlexForm
This commit is contained in:
commit
71600bc4ac
|
@ -1,3 +1,5 @@
|
|||
#!/usr/bin/env Python3
|
||||
|
||||
import PySimpleGUI as sg
|
||||
|
||||
|
||||
|
|
|
@ -431,9 +431,10 @@ def ScriptLauncher():
|
|||
|
||||
def ExecuteCommandSubprocess(command, *args):
|
||||
try:
|
||||
expanded_args = []
|
||||
for a in args:
|
||||
expanded_args += a
|
||||
# expanded_args = []
|
||||
# for a in args:
|
||||
# expanded_args += a
|
||||
expanded_args = [*args]
|
||||
sp = subprocess.Popen([command,expanded_args], shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
out, err = sp.communicate()
|
||||
if out:
|
||||
|
|
|
@ -1433,7 +1433,7 @@ class FlexForm:
|
|||
'''
|
||||
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, scale=(None, 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=True):
|
||||
def __init__(self, title, default_element_size=DEFAULT_ELEMENT_SIZE, default_button_element_size = (None, None), auto_size_text=None, auto_size_buttons=None, scale=(None, 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=True, 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
|
||||
|
@ -1475,6 +1475,7 @@ class FlexForm:
|
|||
self.TextJustification = text_justification
|
||||
self.NoTitleBar = no_titlebar
|
||||
self.GrabAnywhere = grab_anywhere
|
||||
self.KeepOnTop = keep_on_top
|
||||
|
||||
# ------------------------- Add ONE Row to Form ------------------------- #
|
||||
def AddRow(self, *args):
|
||||
|
@ -1647,7 +1648,6 @@ class FlexForm:
|
|||
return screen_width, screen_height
|
||||
|
||||
|
||||
|
||||
def StartMove(self, event):
|
||||
try:
|
||||
self.TKroot.x = event.x
|
||||
|
@ -2666,15 +2666,14 @@ def StartupTK(my_flex_form):
|
|||
_my_windows.Increment()
|
||||
|
||||
my_flex_form.TKroot = root
|
||||
|
||||
# Make moveable window
|
||||
if my_flex_form.NoTitleBar or my_flex_form.GrabAnywhere:
|
||||
root.bind("<ButtonPress-1>", my_flex_form.StartMove)
|
||||
root.bind("<ButtonRelease-1>", my_flex_form.StopMove)
|
||||
root.bind("<B1-Motion>", my_flex_form.OnMotion)
|
||||
|
||||
|
||||
|
||||
if my_flex_form.KeepOnTop:
|
||||
root.wm_attributes("-topmost", 1)
|
||||
|
||||
# root.protocol("WM_DELETE_WINDOW", MyFlexForm.DestroyedCallback())
|
||||
# root.bind('<Destroy>', MyFlexForm.DestroyedCallback())
|
||||
|
|
Loading…
Reference in New Issue