[Tutor] gtk.Notebook error

Amit Sethi amit.pureenergy at gmail.com
Mon Jul 13 23:04:16 CEST 2009


Hi ,
I am having problem with adding pages to gtk.Notebook :

What I want is to be able to pass a random container widget to a new tab:

thus my code is :

class SmNotebook(gtk.Notebook):
	def __init__(self):
		gtk.Notebook.__init__(self)
		    #set the tab properties
		self.set_property('homogeneous', True)
		    #we do not show the tab if there is only one tab i total
		self.set_property('show-tabs', True)

  	def new_tab(self,widget_to_render,title='Page'):
    		nbpages = self.get_n_pages()
	        self.append_page(widget_to_render)
	    	
Now while creating I do :

def new_tab(widget,widget_render):
   	
    notebook.new_tab(widget_render)

  notebook = SmNotebook()
  box.pack_start(notebook)
  box2=gtk.VBox()
  icons = gtk.STOCK_ABOUT
  image = gtk.Image()
  image.set_from_stock(icons, gtk.ICON_SIZE_DIALOG)
  box2.pack_start(image,False)
  button.connect("clicked", new_tab,box2)

* I have deleted the parts of the code that did not seem to be
required . The later part of the code is just for testing..


when I do this I get  a warning :   smnotebook.py:18: GtkWarning:
Can't set a parent on widget which has a parent.


what am I doing wrong here??


-- 
A-M-I-T S|S


More information about the Tutor mailing list