This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author chris_mo
Recipients
Date 2002-02-12.23:21:03
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
Problem: NoteBook add/delete/add page with the same 
name does not work. python2.2/Tix

Example Python Script for reproducing the Bug:

import Tix
import rlcompleter
root=Tix.Tk()
notebook=Tix.NoteBook(root, ipadx=3, ipady=3)
notebook.add('general', label="General", underline=0)
notebook.add('displaymode', label="Display mode", 
underline=0)
notebook.pack()
notebook.delete('general')
notebook.add('general', label="General", underline=0)
la=Tix.Label(notebook.general,text="hallo")
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/usr/lib/python2.2/lib-tk/Tkinter.py", line 
2261, in __init__
    Widget.__init__(self, master, 'label', cnf, kw)
  File "/usr/lib/python2.2/lib-tk/Tkinter.py", line 
1756, in __init__
    self.tk.call(
TclError: bad window path name 
".135915860.nbframe.general"   

Tix seems nothing to know about the new page
>>> notebook.tk.call(notebook._w,'pages')
'displaymode'

Analysis:
in NoteBook.add() the new "same named" widget will
succesfully created in tk. But it will be immediatly 
removed, if the TixSubWidget is constructed

Solution:
In the Notebook class:
Do mark subwidget "destroy_physically=1". Also
for clearness delete entry from subwidget_list dict.
I dont't know if this is a fine or correct solution
but it works (for me)

Patch:
derrick:chris$ diff -u 
/usr/lib/python2.2/lib-tk/Tix.py Tix.py
--- /usr/lib/python2.2/lib-tk/Tix.py    Sun Nov  4 
01:45:36 2001
+++ Tix.py      Tue Feb 12 23:41:50 2002
@@ -828,12 +828,13 @@
     def add(self, name, cnf={}, **kw):
        apply(self.tk.call,
              (self._w, 'add', name) + 
self._options(cnf, kw))
-       self.subwidget_list[name] = 
TixSubWidget(self, name)
+       self.subwidget_list[name] = 
TixSubWidget(self, name, destroy_physically
        return self.subwidget_list[name]   

     def delete(self, name):
+       del self.subwidget_list[name]
        self.tk.call(self._w, 'delete', name) 
-
+       
     def page(self, name):
        return self.subwidget(name)
 


Tix.py Version
# $Id: Tix.py,v 1.4 2001/10/09 11:50:55 loewis Exp $

Tix Version
tix-8.1.3

Tcl/Tk-version
tcl8.3-8.3.3
tk8.3_8.3.3


History
Date User Action Args
2007-08-23 13:59:13adminlinkissue516703 messages
2007-08-23 13:59:13admincreate