Skip to content

Commit

Permalink
Button image_subsample paramter now works if no size is set
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeTheWatchGuy committed Jan 16, 2019
1 parent 9e6d846 commit ee81ce6
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions PySimpleGUI.py
Expand Up @@ -4917,21 +4917,21 @@ def CharWidthInPixels():
if element.ImageFilename: # if button has an image on it
tkbutton.config(highlightthickness=0)
photo = tk.PhotoImage(file=element.ImageFilename)
if element.ImageSubsample:
photo = photo.subsample(element.ImageSubsample)
if element.ImageSize != (None, None):
width, height = element.ImageSize
if element.ImageSubsample:
photo = photo.subsample(element.ImageSubsample)
else:
width, height = photo.width(), photo.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)
photo = tk.PhotoImage(data=element.ImageData)
if element.ImageSubsample:
photo = photo.subsample(element.ImageSubsample)
if element.ImageSize != (None, None):
width, height = element.ImageSize
if element.ImageSubsample:
photo = photo.subsample(element.ImageSubsample)
else:
width, height = photo.width(), photo.height()
tkbutton.config(image=photo, compound=tk.CENTER, width=width, height=height)
Expand Down

0 comments on commit ee81ce6

Please sign in to comment.