Alexander Kuleshov <kuleshovm...@gmail.com> wrote: > Hello. I have following problem. Am writing a simple program with > pygtk. I have a window on it located menu, statusbar and NoteBook. The > tabs should be located NoteBook element GtkTextView. By clicking on > the menu, I must appear a new tab with GtkTextView. But I get the > following: Can't set a parent on widget which has a parent > > What to do in this case?
It is possible to use single text view widget, but you have to reparent it on every notebook page change -- and this is not correct way. The right solution is to create new text view for every file. So, your code should look like this: def __init__(self): self.editors = [] # holds all textview widgets ... def new_file(self,widget): self.doc_num += 1 b = len(self.documents) editor = gtk.TextView() self.editors.append(editor) self.tab_panel.append_page(editor, gtk.Label("ASD")) hth w. _______________________________________________ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://faq.pygtk.org/