How to make a shape a button in Tkinter How to make a shape a button in Tkinter tkinter tkinter

How to make a shape a button in Tkinter


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...

button = Canvas.create_rectangle(100, 100, 200, 200, fill = 'red', activefill = 'blue')

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

also if u just want a button:

from tkinter import *def say_hello():    print("Hello")root = Tk()btn1 = Button(root, text="Hello", command=say_hello)btn1.pack()root.mainloop()

when pressed it will print hello!