[Python-bugs-list] [ python-Bugs-516703 ] Tix:NoteBook add/delete/add page problem
noreply@sourceforge.net
noreply@sourceforge.net
Tue, 12 Feb 2002 15:31:14 -0800
Bugs item #516703, was opened at 2002-02-12 15:21
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=516703&group_id=5470
Category: Tkinter
Group: Python 2.2
Status: Open
>Resolution: Works For Me
Priority: 5
Submitted By: Christoph Monzel (chris_mo)
Assigned to: Nobody/Anonymous (nobody)
Summary: Tix:NoteBook add/delete/add page problem
Initial Comment:
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
----------------------------------------------------------------------
>Comment By: Christoph Monzel (chris_mo)
Date: 2002-02-12 15:31
Message:
Logged In: YES
user_id=456854
Okay, this is my first bug report, and seems not a good
idea to paste patches into the text window :(
----------------------------------------------------------------------
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=516703&group_id=5470