Al in Dallas wrote: > I'm new to Python*. I am having trouble with the Tix NoteBook > megawidget. When I use a simpler megawidget, such as a ButtonBox, I can > add buttons by invoking > > <nameOfButtonBox>.add ('button3', text='Retry') > > Unfortunately, with the Notebook, I need access to a subwidget, and all > my attempts have led to error messages. When I try to look up the > megawidget documentation, I can only find example in Tcl, so I'm > confident that if someone explains the syntax of the TixNoteBook > megawidget to me, I should be able to figure it out for all the other > megawidgets on my own. Here's an attempt to add something to the hlist > subwidget: > > >>> lnotebook.hlist.add ('wrongsyntax') > Traceback (most recent call last): > File "<stdin>", line 1, in ? > File "C:\Python24\lib\lib-tk\Tix.py", line 863, in add > return self.tk.call(self._w, 'add', entry, *self._options(cnf, kw)) > _tkinter.TclError: invalid command name > ".12204992.pane.p1.shlist.f1.hlist" > > *I evaluated it many years ago (1996) when the only other choices > seemed to be Perl, Tcl, and VB. Unfortunately, my various employers > chose which scripting language would be used, and none of them ever > chose Python. Oddly, I ended up using all of the others.
Well, I've found a partial answer for a slightly less complicated megawidget: >>> nbpage1 = notebook.add ('first',label="First") >>> nbpage2 = notebook.add ('second',label="Second") >>> notebook.pages() [<Tix.TixSubWidget instance at 0x00BAB940>, <Tix.TixSubWidget instance at 0x00BA BDF0>] >>> notebook.subwidget_list {'nbframe': <Tix.TixSubWidget instance at 0x00BABC38>, 'second': <Tix.TixSubWidg et instance at 0x00BABDF0>, 'first': <Tix.TixSubWidget instance at 0x00BAB940>} >>> nblab = Tix.Label(nbpage1,text="Test First Tab") >>> nblab.pack() >>> nbbtn = Tix.Button(nbpage2,text="Test Second Tab") >>> nbbtn.pack() >>> nbbbox = Tix.ButtonBox(nbpage1) >>> nbbbox.add ('nbbxb1',text='Yeah!') '.12236560.nbframe.first.12237760.nbbxb1' >>> nbbbox.pack() >>> nbbbox.add ('nbbxb2',text='Nah...') '.12236560.nbframe.first.12237760.nbbxb2' >>> nbp2lab1 = Tix.Label(nbpage2,text='This is the second most\ncomplicated widg et that has been mastered\nCome over some day maybe play poker') >>> >>> nbp2lab1.pack() I still don't have ListNoteBook widgets sussed, but I'm on the road. -- http://mail.python.org/mailman/listinfo/python-list