Skip to content
Advertisement

How to make a shape a button in Tkinter

Is there a way to make a shape a button in a tkinter canvas?

JavaScript

Or, to put it simply, is there a way to figure out if the user clicked the rectangle drawn above?

Advertisement

Answer

I don’t know how to see if someone clicks the rectangle but you could have the color change if a cursor hovers over it…

I’m going to make the rectangle red, and then it will turn blue with a cursor hovering over…

JavaScript

this might not be exactly what you are looking for, but it is another option…

also if u just want a button:

JavaScript

when pressed it will print hello!

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement