Skip to content Skip to sidebar Skip to footer

Create Image In Button

How do I create an image in button. Instead of having text saying 'Draw' I want it to be a picture of a brush. Code: self.draw_button = Button(self.root, text='Draw', command=self.

Solution 1:

Create an image with tkinter's PhotoImage then set it inside Button.

from tkinter import *

root = Tk()

img = PhotoImage(file='paint_brush.png')

draw_button = Button(root, image=img)
draw_button.grid(row=0, column=0)

root.mainloop()

Post a Comment for "Create Image In Button"