Skip to content
Permalink
Browse files

Window gets new `transparent_color` parameter and `SetTransparentColo…

…r` method
  • Loading branch information...
MikeTheWatchGuy committed May 14, 2019
1 parent abd0caa commit 9dc029e9cda09231428ba88f997ea8f11f257324
Showing with 127 additions and 49 deletions.
  1. +16 −1 PySimpleGUI.py
  2. +111 −48 PySimpleGUI27.py
@@ -3535,7 +3535,7 @@ def __init__(self, title, layout=None, default_element_size=DEFAULT_ELEMENT_SIZE
progress_bar_color=(None, None), background_color=None, border_depth=None, auto_close=False,
auto_close_duration=DEFAULT_AUTOCLOSE_TIME, icon=DEFAULT_WINDOW_ICON, force_toplevel=False,
alpha_channel=1, return_keyboard_events=False, use_default_focus=True, text_justification=None,
no_titlebar=False, grab_anywhere=False, keep_on_top=False, resizable=False, disable_close=False, disable_minimize=False, right_click_menu=None):
no_titlebar=False, grab_anywhere=False, keep_on_top=False, resizable=False, disable_close=False, disable_minimize=False, right_click_menu=None, transparent_color=None):
'''
Window
:param title:
@@ -3623,6 +3623,8 @@ def __init__(self, title, layout=None, default_element_size=DEFAULT_ELEMENT_SIZE
self.Margins = margins if margins != (None, None) else DEFAULT_MARGINS
self.ContainerElemementNumber = Window.GetAContainerNumber()
self.AllKeysDict = {}
self.TransparentColor = transparent_color

if layout is not None:
self.Layout(layout)

@@ -4164,6 +4166,9 @@ def VisibilityChanged(self):
# A dummy function. Needed in Qt but not tkinter
return

def SetTransparentColor(self, color):
self.TKroot.attributes('-transparentcolor', color)

def __enter__(self):
return self

@@ -6164,6 +6169,7 @@ def StartupTK(my_flex_form:Window):
else:
root = tk.Toplevel()


try:
root.attributes('-alpha', 0) # hide window while building it. makes for smoother 'paint'
except:
@@ -6190,6 +6196,9 @@ def StartupTK(my_flex_form:Window):
if my_flex_form.KeepOnTop:
root.wm_attributes("-topmost", 1)

if my_flex_form.TransparentColor is not None:
my_flex_form.SetTransparentColor(my_flex_form.TransparentColor)

# root.protocol("WM_DELETE_WINDOW", MyFlexForm.DestroyedCallback())
# root.bind('<Destroy>', MyFlexForm.DestroyedCallback())
ConvertFlexToTK(my_flex_form)
@@ -7779,7 +7788,9 @@ def main():

window = Window('Window Title', layout,
font=('Helvetica', 13),
background_color='black',
right_click_menu=['&Right', ['Right', '!&Click', '&Menu', 'E&xit', 'Properties']],
# transparent_color= '#9FB8AD',
).Finalize()
graph_elem.DrawCircle((200, 200), 50, 'blue')
i = 0
@@ -7802,6 +7813,10 @@ def main():
if event == 'Button':
print(window.AllKeysDict)
window.Element('_TEXT1_').SetTooltip('NEW TEXT')
window.SetTransparentColor( '#9FB8AD')
# window.TKroot.wm_attributes("-transparent", '#9FB8AD')
# window.TKroot.wm_attributes("-transparentcolor", '#9FB8AD')

# TimerStop()
window.Close()

Oops, something went wrong.

0 comments on commit 9dc029e

Please sign in to comment.
You can’t perform that action at this time.