Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tkinter custom create buttons

Tags:

Can tkinter create custom buttons from an image or icon like this?

enter image description here

like image 694
bunyaminkirmizi Avatar asked Aug 20 '16 12:08

bunyaminkirmizi


1 Answers

It's possible!

If you check out the button documentation, you can use an image to display on the button.

For example:

from tkinter import *  root = Tk()  button = Button(root, text="Click me!") img = PhotoImage(file="C:/path to image/example.gif") # make sure to add "/" not "\" button.config(image=img) button.pack() # Displaying the button  root.mainloop() 

This is a simplified example for adding an image to a button widget, you can make many more cool things with the button widget.

like image 156
PyDer Avatar answered Nov 08 '22 17:11

PyDer