Home > Net >  Python Tkinter Canvas Bug
Python Tkinter Canvas Bug

Time:11-28

1- I create an image

2- Make it so when I click on it, it executes a function (which just prints some sh*t for now)

3- THE PROBLEM IS, when I click on the image, only the bottom part registers the click. The middle and the top part of the image is completely unresponsive.

What's going on? I'm open to using different Tkinter techniques, I just want a button with a custom image that freaking works properly. If I use the classic Tkinter Button, there's an ugly background around the image.

self.upload_button = self.graphics_instance.main_canvas.create_image(self.upload_button_coordinates_x, self.upload_button_coordinates_y, anchor=Enums.CENTER, image=self.graphics_instance.upload_button_image)
self.graphics_instance.main_canvas.tag_bind(self.upload_button, "<1>", self.upload_command_execution)

CodePudding user response:

I solved the issue, it was my mistake. Apparently I had an image interfering with the button I was trying to click, causing it to be clickable only in the bottom. I simply created that image first, and the button second, now everything works like a charm.

  • Related