Problems with Pmw

David LeBlanc whisper at oz.net
Sun Jun 23 21:19:08 EDT 2002


You have to initialize Pmw and that's not the way to create a top level
window.
Try this:

from Tkinter import *
root = Tk()
import Pmw
Pmw.initialise(root)

t2 = Toplevel()
l = Label(t2, text='A label') ; l.pack()
b = Button(t2, text='Press me') ; b.pack()
e = Pmw.EntryField(t2, labelpos=W, label_text='Enter something') ; e.pack()
t2.mainloop()

David LeBlanc
Seattle, WA USA

> -----Original Message-----
> From: python-list-admin at python.org
> [mailto:python-list-admin at python.org]On Behalf Of Mark Rivers
> Sent: Sunday, June 23, 2002 17:36
> To: python-list at python.org
> Subject: Problems with Pmw
>
>
> Folks,
>
> In a previous post I mistakenly attributed one problem to Pmw.Blt, while
> subsequent testing has shown that the problem has nothing to do
> with Blt, it
> is a problem (?) with Pmw.
>
> The problem is illustrated by the following short script:
> ########################################
> from Tkinter import *
> import Pmw
> t1 = Tk()
> t2 = Tk()
> l = Label(t2, text='A label'); l.pack()
> b = Button(t2, text='Press me'); b.pack()
> e = Pmw.EntryField(t2, labelpos=W, label_text='Enter something'); e.pack()
> ########################################
>
> Executing this script as shown results in the first Tk() window (t1) being
> created, and the second Tk() window (t2) and the Label and Button widgets
> being created, and then the following error when creating the
> Pmw.EntryField:
>
> Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
>   File "testBlt2.py", line 7, in ?
>     e = Pmw.EntryField(t2, labelpos=W, label_text='Enter something');
> e.pack()
>   File "C:\PROGRA~1\Python21\Pmw\Pmw_0_8_5\lib\PmwEntryField.py", line 72,
> in __
> init__
>     sequences = root.bind_class(tag)
>   File "C:\PROGRA~1\Python21\lib\lib-tk\Tkinter.py", line 923, in
> bind_class
>     return self._bind(('bind', className), sequence, func, add, 0)
>   File "C:\PROGRA~1\Python21\lib\lib-tk\Tkinter.py", line 858, in _bind
>     return self.tk.splitlist(self.tk.call(what))
> TclError: bad window path name ".15422476.15422044"
>
> If the line "t1 = Tk()" is commented out then it works fine.
>
> This happens both on Win32 and Linux with Python 2.1, and Pmw 0.8.5.
>
> I think it should be legal to create multiple Tk() windows in an
> application, so this seems like a serious bug?
>
> Thanks,
>
>               Mark Rivers
>               Dept. of Geophysical Sciences, University of Chicago
>               GSECARS, Advanced Photon Source, Argonne National Laboratory
>
>
>
> --
> http://mail.python.org/mailman/listinfo/python-list






More information about the Python-list mailing list