Newbie Tkinter problem

Simpa sinisa_pavlovic at
Thu Mar 29 13:55:08 CEST 2001


When I start the following script twice, without leaving Python I got
TclError message (first time everything is OK). What am I doing wrong?

I am using Python 1.5.2 for Win32 with Mark Hammond's PyWin, but same
things happend on IDLE too.

Thanks in advance.

from Tkinter import *

class Wind:
    def __init__(self):
        self.root = Tk()
        self.root.title('Show image')
        self.c = Canvas(self.root,background = 'green') = PhotoImage(name = 'wedda',file="wedda.gif")


MyWind = Wind()

>>> Traceback (innermost last):
  File "D:\PythonW32\Pythonwin\pywin\framework\", line
237, in RunScript
    exec codeObject in __main__.__dict__
  File "D:\Private\PythonProba\Tkinter\", line 17, in ?
    MyWind = Wind()
  File "D:\Private\PythonProba\Tkinter\", line 11, in __init__ = PhotoImage(name = 'wedda',file="wedda.gif")
  File "D:\Python\Lib\lib-tk\", line 1874, in __init__
    apply(Image.__init__, (self, 'photo', name, cnf, master), kw)
  File "D:\Python\Lib\lib-tk\", line 1839, in __init__'image', 'create', imgtype, name,) + options)
TclError: can't invoke "image" command:  application has been

More information about the Python-list mailing list