Re: [pygtk] Can't set a parent on widget which has a parent
Alexander Kuleshov 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/
Re: [pygtk] Can't set a parent on widget which has a parent
Il giorno mar, 09/02/2010 alle 18.36 +0600, Alexander Kuleshov ha scritto: > 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? > Replace self.tab_panel.append_page(self.editor, gtk.Label("ASD")) with self.tab_panel.append_page(gtk.TextView(), gtk.Label("ASD")) self.tab_panel.show_all() , then, fix the organization of the program in order to make it do what you want. Pietro signature.asc Description: Questa è una parte del messaggio firmata digitalmente ___ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://faq.pygtk.org/