0

Using tkinter, how can I make a button that it is picture not text?

2
  • 1
    Possible duplicate of Image on a button Commented 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. Commented Feb 21, 2016 at 14:17

1 Answer 1

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
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.