Problems with Pmw.Blt

Mark Rivers rivers at cars.uchicago.edu
Mon Jun 24 02:06:43 CEST 2002


Folks,

I am having some problems with Pmw.Blt running Python 2.1.3 on Win32 and
Python 2.1.1 on Linux.  Pmw is version 0.8.5 and Blt is version 2.4.

I found descriptions of the first problem in the newsgroup archives, but no
solutions were posted.
Here is a short script that demonstrates the problem:
#################################
from Tkinter import *
import Pmw
t1 = Tk()
g1 = Pmw.Blt.Graph(t1); g1.pack()
t2 = Tk()
#reload(Pmw.Blt)
g2 = Pmw.Blt.Graph(t2); g2.pack()
#################################

When this script is run right after starting Python, the following happens.
The first Tk() window (t1) and the first Blt.Graph (g1) are created fine.
The second Tk() window (t2) is created and then the following error occurs:

Traceback (most recent call last):
  File "U:\Rivers\python\epics\testBlt1.py", line 7, in ?
    g2 = Pmw.Blt.Graph(t2); g2.pack()
  File "C:\PROGRA~1\Python21\Pmw\Pmw_0_8_5\lib\PmwBlt.py", line 260, in
__init__
    Tkinter.Widget.__init__(self, master, _graphCommand, cnf, kw)
  File "C:\PROGRA~1\Python21\lib\lib-tk\Tkinter.py", line 1756, in __init__
    self.tk.call(
TclError: invalid command name "::blt::graph"

I can eliminate this error if I uncomment the line "reload(Pmw.Blt).  I have
been using this workaround in my applications with 99% success.  Just before
every call to create a Pmw.Blt.Graph I execute the statement
"reload(Pmw.Blt)".  However, this workaround cannot be the right way to do
things, and it seems like it is occasionally creating problems, as evidenced
in the next example.

The second problem is illustrated in the following simple script:
#########################################
from Tkinter import *
import Pmw
t1 = Tk()
reload(Pmw.Blt)
g1 = Pmw.Blt.Graph(t1); g1.pack()
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()
#########################################

When this script is run, the first Tk() window (t1) and the Pmw.Blt.Graph
(g1) appear OK.  The second Tk() window (t2) is created, and the Label and
Button widgets are created.  However, when the Pmw.EntryField is being
created the following error occurs:

Traceback (most recent call last):
  File "U:\Rivers\python\epics\testBlt2.py", line 9, in ?
    e = Pmw.EntryField(t2, labelpos=W, label_text='Enter something')
  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 ".45079580.45079148"

Any suggestions will be most appreciated!

Thanks,

              Mark Rivers
              Dept. of Geophysical Sciences, University of Chicago
              GSECARS, Advanced Photon Source, Argonne National Laboratory





More information about the Python-list mailing list