| | |
Jpg in tkinter
Thread Solved |
•
•
Join Date: Jul 2006
Posts: 608
Reputation:
Solved Threads: 150
Not if your code needs to run on a Mac ...
The best bet is to get PIL, the Python Imaging Library. Link here.
Then you can construct some simple code like
From there, you can pass the tkim object as a parameter to anything that will accept an image: a Label(), a Button(), a Canvas() ...
Hope it helps,
Jeff
•
•
•
•
But anyway. How can I get tkinter to load up a jpg?
Then you can construct some simple code like
Python Syntax (Toggle Plain Text)
import Image, ImageTk im = Image.open(filename) # loads a wide variety of file types as a # PIL image. The PIL image has a # rich set of methods tkim = ImageTk.PhotoImage(im) # Converts to Tkinter-friendly # image type
From there, you can pass the tkim object as a parameter to anything that will accept an image: a Label(), a Button(), a Canvas() ...
Hope it helps,
Jeff
![]() |
Similar Threads
- Putting an image into a Tkinter thingy (Python)
- How to create a .jpg file with a drawing in Tkinter ? (Python)
- Tkinter window background (Python)
- Tkinter Button "Disable" ? (Python)
- Tkinter Countdown Timer problems. (Python)
- Tkinter GUI Issues: (Python)
- Tkinter or wxPython? (Python)
Other Threads in the Python Forum
- Previous Thread: Using a Variable to Identify an Instance
- Next Thread: A line class for coordinate geometry
| Thread Tools | Search this Thread |
address aliased anydbm app bash beginner bits calling casino changecolor cipher clear conversion coordinates corners count cturtle curves definedlines development dictionary digital dynamic events examples excel external feet file float format function gui handling hints homework i/o iframe images import input java keycontrol line linux list lists loan loop matching mouse multiple number numbers output parsing path port prime programming projects py py2exe pygame pymailer python random rational raw_input recursion recursive scrolledtext searchingfile signal singleton split string strings tails terminal text threading time tlapse tooltip tuple tutorial type ubuntu unicode url urllib urllib2 valueerror variable web-scrape whileloop word wxpython xlwt





