Improvements to the newer PIL demos

This commit is contained in:
PySimpleGUI 2021-05-25 14:16:21 -04:00
parent b670662ead
commit 3b00d39c3a
2 changed files with 8 additions and 12 deletions

View File

@ -60,17 +60,16 @@ def rounded_rectangle(text, font=('arial.ttf', 14), button_color=None,):
return im_to_data(im)
sg.theme("dark red")
# sg.theme("dark green 7")
# sg.theme("dark red")
sg.theme("dark green 7")
# sg.set_options(font=("Arial", 16))
layout = [[sg.Button('Normal Button')],
[sg.Button('', image_data=sg.EMOJI_BASE64_HAPPY_THUMBS_UP, border_width=0, button_color=(sg.theme_background_color(), sg.theme_background_color()))],
[sg.Button(image_data=rounded_rectangle('Button text\nwith 2 lines', font=('cour.ttf', 15)), button_color=(sg.theme_background_color(), sg.theme_background_color()), border_width=0)]]
# [sg.Button(image_data=rounded_rectangle('Button text\nwith 2 lines', font=('cour.ttf', 15)), button_color=(sg.theme_background_color(), sg.theme_background_color()), border_width=0)]]
[sg.Button(image_data=rounded_rectangle('Button text\nwith 2 lines', font=('arial.ttf', 25)), button_color=(sg.theme_background_color(), sg.theme_background_color()), border_width=0)]]
layout += [
[sg.Button(
image_data=rounded_rectangle(text, font=('cour.ttf', 15)),
image_data=rounded_rectangle(text, font=('cour.ttf', 25)),
button_color=(sg.theme_button_color()[0], sg.theme_background_color()),
border_width=0)]
for text in (
@ -80,7 +79,7 @@ layout += [
"123\n2\n3")
]
window = sg.Window('Image and Rounded Button', layout, finalize=True)
window = sg.Window('Image and Rounded Button', layout, finalize=True, keep_on_top=True, use_custom_titlebar=True)
while True:

View File

@ -65,7 +65,7 @@ layout = [[sg.T('PIL Made Toggle Buttons')],
[sg.Button(image_data=button_off, button_color=(sg.theme_background_color(), sg.theme_background_color()), border_width=0, k='-B2-', metadata=False)]]
window = sg.Window('PIL Buttons', layout, finalize=True, element_justification='c', use_custom_titlebar=True, font='_ 18')
window = sg.Window('PIL Buttons', layout, finalize=True, element_justification='c', use_custom_titlebar=True, font='_ 18', keep_on_top=True)
while True:
@ -73,9 +73,6 @@ while True:
if event in (sg.WINDOW_CLOSED, "Exit"):
break
window[event].metadata = not window[event].metadata
if window[event].metadata:
window[event].update(image_data=button_on)
else:
window[event].update(image_data=button_off)
window[event].update(image_data=button_on if window[event].metadata else button_off)
window.close()