Using tkinter, how can I make a button that it is picture not text?
-
1Possible duplicate of Image on a buttonTom Cupis– Tom Cupis2016-02-21 13:32:02 +00:00Commented Feb 21, 2016 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– Bryan Oakley2016-02-21 14:17:19 +00:00Commented Feb 21, 2016 at 14:17
Add a comment
|
1 Answer
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