Using tkinter, how can I make a button that it is picture not text?
Asked
Active
Viewed 4,743 times
0
-
1Possible duplicate of [Image on a button](http://stackoverflow.com/questions/4297949/image-on-a-button) – Tom Cupis Feb 21 '16 at 13:32
-
There must be millions of examples on the internet, and this feature is widely documented. You should do a little research before asking a basic question like this. – Bryan Oakley Feb 21 '16 at 14:17
1 Answers
3
Some searching revealed Image on a button. It uses the PhotoImage
function. To explain some code included in it:
from Tkinter import * # Import tkinter
root=Tk() # Create an instance using Tk()
b=Button(root,justify = LEFT) # Create a button
photo=PhotoImage(file="mine32.gif") # Give photo an image
b.config(image=photo,width="10",height="10") # Configure the earlier instance to use the photo
b.pack(side=LEFT) # Pack up the button
root.mainloop() # Create everything