Mailing List Archive

[Tkinter] Inheriting from Toplevel
I am having some fairly weird problems with my Tkinter app. I am
spawning a new Toplevel window where I display a graph in a
canvas instance. However, when I send the data to the widget to
be plotted, the whole thing freezes. Since the plotting class works
fine when run by itself, I can only assume that I have some problems
with the way that the windows are instantiated. Here is a general
outline:

The RootInterface inherits from Frame:

class RootInterface(Frame):

def __init__(self,parent=None):
Frame.__init__(self,parent)
self.pack()
...

which is instantiated in the usual way:

if __name__ == '__main__':
root = Tk()
main = RootInterface(root)
main.pack()
root.mainloop()

Now, when a menu item is chosen from RootInterface, the Plot window
is brought up:
self.dfWindow = DFWindow(self)

where DFWindow inherits from Toplevel:

class DFWindow(Toplevel):

def __init__(self,master):
Toplevel.__init__(self,master)
self.plot = Plotter(self,0.0,md.cvar.dfcutoff,0.0,0.0,
"Distribution Function")
self.plot.pack()

and the self.plot is an instance of Plotter which inherits from
Frame and contains the canvas and plotting methods. When I want to
plot something, a method in RootInterface is called which calls a
method in DFWindow which finally calls the plotting method in Plotter.

My question is, am I doing something wrong that would cause the
strange behavior that I described earlier? I apologize for the length
of this message, but I am at my wits end.

Thanks,

Dave




Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
[Tkinter] Inheriting from Toplevel [ In reply to ]
dwolff567@my-deja.com wrote:
> I am having some fairly weird problems with my Tkinter app. I am
> spawning a new Toplevel window where I display a graph in a
> canvas instance. However, when I send the data to the widget to
> be plotted, the whole thing freezes.

I'd look for a widget that is created without a master, and
displayed using a call to "grid"...

if you don't use grid at all, you probably have to post more
code...

</F>
[Tkinter] Inheriting from Toplevel [ In reply to ]
I use grid only in dialog boxes which inherit from the dialog class
you posted on the pythonware site.

Dave

In article <001d01bed86f$39de44f0$f29b12c2@secret.pythonware.com>,
"Fredrik Lundh" <fredrik@pythonware.com> wrote:
> dwolff567@my-deja.com wrote:
> > I am having some fairly weird problems with my Tkinter app. I am
> > spawning a new Toplevel window where I display a graph in a
> > canvas instance. However, when I send the data to the widget to
> > be plotted, the whole thing freezes.
>
> I'd look for a widget that is created without a master, and
> displayed using a call to "grid"...
>
> if you don't use grid at all, you probably have to post more
> code...
>
> </F>
>
>


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.