Hello pals.

We're having a project to make a Backup and Restore program in Python. As we think that making a GUI is of course very important, we started using Tkinter after initially trying wxPython which was kind of difficult given the time we had.

Either way, we made a Class where the main window is. Inside this Class, there is another Class defined, which contains the code of the another Window, where one can chose the options of the backup proccess. So, here's the thing. While we have made two text entries and two buttons, when trying to load an image, or any label for all it matters, it just won't appear, and we get the following error in Python Shell.

Exception in Tkinter callback
Traceback (most recent call last):
  File "C:\Python25\lib\lib-tk\Tkinter.py", line 1414, in __call__
    return self.func(*args)
  File "C:\Users\Ash_Pokemaster\Desktop\project_e31\kuygku.py", line 110, in backup_window
    back = Backup(buwind)
  File "C:\Users\Ash_Pokemaster\Desktop\project_e31\kuygku.py", line 94, in __init__
    self.labelcho = Button(framebu, image= photocho)
  File "C:\Python25\lib\lib-tk\Tkinter.py", line 2012, in __init__
    Widget.__init__(self, master, 'button', cnf, kw)
  File "C:\Python25\lib\lib-tk\Tkinter.py", line 1942, in __init__
    (widgetName, self._w) + extra + self._options(cnf))
TclError: image "pyimage8" doesn't exist

Here is the code along with the images.

We would appeciate it if you could try create an image inside the Backup Class, and figure out what the problem is.

So far, this is what we type between the two text entry eidgets, and of course doesn't work:

photocho = PhotoImage(file=choose.gif")
                self.labelcho = Button(framebu, image= photocho)
                self.labelcho.image = photocho
                self.labelcho.grid(row=2, column=0)

Image "choose.gif" is not inside the zip, but I guess any image would work...

Thanks for your time.

Recommended Answers

All 3 Replies

Inside this Class, there is another Class

Why is this necessary. Everything should be in functions inside a single class, or two classes with one calling an instance of the other.

TclError: image "pyimage8" doesn't exist

You are probably looking in the wrong directory. Use the absolute directory + file name for the image = /path/to/images/choose.gif

## missing a quote on the following line
photocho = PhotoImage(file=choose.gif")
                self.labelcho = Button(framebu, image= photocho)
                self.labelcho.image = photocho

                ## you can not use grid and pack.  Pick one only
                self.labelcho.grid(row=2, column=0)

Effbot's Photoimage page http://effbot.org/tkinterbook/photoimage.htm

For any more help you will have to post some code.

commented: Thanks man +0

All fixed when I used one class instead of two. Thanks guys. ;)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.