On Fri, Oct 5, 2012 at 1:10 PM, Matthew Ngaha <chigga...@gmail.com> wrote:
> with no solution to my problem after 2 days of pulling my hair out:( i
> realize that some libraries are best for the Python version they
> support the most. Sadly most tkinter users use version 2 unlike me, so
> im pretty much on my own as the solutions don't apply to me. Can
> someone please recommend me a toolkit that is fully supported on
> Python 3 and has a similar or easier learning curve to tkinter? thanks
> for all the help and effort guys.

Matthew:

Sorry for your problems. Tkinter isn't usually so hard for people to
get started with.

Your original message showed you were trying to open a .jpg image. Do
you have the option of converting it to the GIF format? If so, you
don't need PIL at all since .GIF is directly supported by Tkinter.
For example, to display a GIF  image you can do this:

    class ExampleApp(tk.Tk):
        def __init__(self):
            tk.Tk.__init__(self)
            self.image = tk.PhotoImage(file=image_file)
            label = tk.Label(self, image=self.image)
            label.pack()


    app = ExampleApp()
    app.mainloop()

The above code works for me just fine with Python 3.2. All you need to
do is define 'image_file' to point to a .gif that you want to display.

Unfortunately Tkinter only directly supports .gif and the older
ppm/pgm formats. For any other format you'll need PIL, or some other
way to convert the image to a supported format.

Yeah, I know it's crazy that Tkinter only supports .GIF. For most
people who use Tkinter there are workarounds. Unfortunately, as a
newbie forced to use Python3, the workaround is not so evident.
_______________________________________________
Tkinter-discuss mailing list
Tkinter-discuss@python.org
http://mail.python.org/mailman/listinfo/tkinter-discuss

Reply via email to