Hi Mario, Thus spoketh Mario St-Gelais <mario....@videotron.ca> unto us on Sat, 19 Mar 2011 11:58:16 -0400:
> Good Day All. > > I am trying to get Notebook to work and the following code return > errors. If I replace f2 with something similar to f1, it works. > The problem is the following class definition: > > class FirstFrame(): > def __init__(self,root): > self.root=root > self.frame=Frame(self.root) > self.PlaceButtonCheck() (...) According to this, an instance of the FirstFrame class is *not* a tk widget, but just a generic python object. So you will have to * either replace the following lines in your code: f2=FirstFrame(nb) nb.add(f2, text='in') with f2=FirstFrame(nb) nb.add(f2.frame, text='in')# pass the Frame object to nb.add() * or (better) change your class definition so that the FirstFrame instance becomes a real Frame object by subclassing Frame. The usual way to do this is something like: class FirstFrame(Frame): def __init__(self, *args, **kw): Frame.__init__(self, *args, **kw) self.PlaceButtonCheck() ...(etc.)... (note that you don't need the self.root attribute any longer, because every widget has its parent linked to self.master by default). I hope this helps Michael .-.. .. ...- . .-.. --- -. --. .- -. -.. .--. .-. --- ... .--. . .-. I'm frequently appalled by the low regard you Earthmen have for life. -- Spock, "The Galileo Seven", stardate 2822.3 _______________________________________________ Tkinter-discuss mailing list Tkinter-discuss@python.org http://mail.python.org/mailman/listinfo/tkinter-discuss