You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Buttons that has an image will always have a buffer around said image. If the "width" and "height" attributes are used, the button would disappear completely.
Steps to reproduce the image buffer problem:
Create a normal button with a .png file as the image. image_2= PhotoImage(file = insert image file here.png, height=48, width=55) self.two = Button(root, image=self.image_2, relief=FLAT, bg='#a9a9a9', command=lambda:self.addNum(num=2), bd=0, highlightthickness=0, borderless=1) self.two.grid(row=5, column=2)
Steps to reproduce the disappearing button problem:
Create a normal button with a .png file as the image, set the width and height to any value. image_3= PhotoImage(file = insert image file here.png, height=48, width=55) self.three = Button(root, image=self.image_3, relief=FLAT, bg='#a9a9a9',command=lambda:self.addNum(num=3), width=100, height=200) self.three.grid(row=5, column=3)
Expected behavior
The button wraps around the border of the image, making the button just as big as the image used, not bigger and creating a buffer around the image.
Screenshots
Image 1: Buffer around the image
Desktop (please complete the following information):
OS: macOS
Version Big Sur 11.6.1
The text was updated successfully, but these errors were encountered:
Hi Jsnncls! Thanks for mentioning the width / height issue and It will be fixed in the next update hopefully.
However, "button wraps around the border of the image" is not an issue as the tkmacosx button simulates ttk button, not the actual Tkinter button but it can be set by giving some negative padding.
For some reason for width and height, it is not registering them initially for images but you can get away by defining after Button is created like so
Buttons that has an image will always have a buffer around said image. If the "width" and "height" attributes are used, the button would disappear completely.
Steps to reproduce the image buffer problem:
image_2= PhotoImage(file = insert image file here.png, height=48, width=55) self.two = Button(root, image=self.image_2, relief=FLAT, bg='#a9a9a9', command=lambda:self.addNum(num=2), bd=0, highlightthickness=0, borderless=1) self.two.grid(row=5, column=2)
Steps to reproduce the disappearing button problem:
image_3= PhotoImage(file = insert image file here.png, height=48, width=55) self.three = Button(root, image=self.image_3, relief=FLAT, bg='#a9a9a9',command=lambda:self.addNum(num=3), width=100, height=200) self.three.grid(row=5, column=3)
Expected behavior
The button wraps around the border of the image, making the button just as big as the image used, not bigger and creating a buffer around the image.
Screenshots
Image 1: Buffer around the image
Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: