From 975cbdd3828375ca42baff75c2f663faaf756c8c Mon Sep 17 00:00:00 2001 From: MikeTheWatchGuy Date: Mon, 15 Oct 2018 20:07:45 -0400 Subject: [PATCH] Added code to enable text on top of graphic buttons --- PySimpleGUI.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 1f7a57de..95a71f67 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -3363,7 +3363,7 @@ def PackFormIntoFrame(form, containing_frame, toplevel_form): photo = photo.subsample(element.ImageSubsample) else: width, height = photo.width(), photo.height() - tkbutton.config(image=photo, width=width, height=height) + tkbutton.config(image=photo, compound=tk.CENTER, width=width, height=height) tkbutton.image = photo if element.ImageData: # if button has an image on it tkbutton.config(highlightthickness=0) @@ -3374,7 +3374,7 @@ def PackFormIntoFrame(form, containing_frame, toplevel_form): photo = photo.subsample(element.ImageSubsample) else: width, height = photo.width(), photo.height() - tkbutton.config(image=photo, width=width, height=height) + tkbutton.config(image=photo, compound=tk.CENTER, width=width, height=height) tkbutton.image = photo if width != 0: tkbutton.configure(wraplength=wraplen+10) # set wrap to width of widget