[Tkinter] Inheriting from Toplevel

dwolff567 at my-deja.com dwolff567 at my-deja.com
Tue Jul 27 15:50:03 EDT 1999


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.




More information about the Python-list mailing list