<br>hi Andi,<br>I tried your second solution.But it is giving the error:&#39;glade.XML&#39; object has no attribute &#39;get_child&#39;<br>for your reference i am sending my whole folder as tar.gz.Please refer it .<br>Thanks for your help.<br>
<br>Njoy the share of Freedom,<br>Anusha<br><br><div class="gmail_quote">On Sat, Jan 10, 2009 at 1:11 PM, Andi Albrecht <span dir="ltr">&lt;<a href="mailto:albrecht.andi@googlemail.com">albrecht.andi@googlemail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="Ih2E3d">Hi Anusha,<br>
<br>
I think there are two problems here: First you have to reparent the<br>
widget you want to add to the notebook and then you can&#39;t add toplevel<br>
windows to notebooks.<br>
<br>
I could not test it, but IMO show_newOrganisation() should look<br>
something like this (where NAME_OF_THE_WIDGET is the name of the first<br>
child widget in your second glade file):<br>
<br>
</div><div class="Ih2E3d">def show_newOrganisation(self,widget):<br>
 &nbsp; &nbsp; &nbsp; <a href="http://new_org.org" target="_blank">new_org.org</a>()<br>
 &nbsp; &nbsp; &nbsp; self.gladefile_newOrg = &quot;new_org.glade&quot;<br>
</div> &nbsp; &nbsp; &nbsp; widget = gtk.glade.XML(self.gladefile_newOrg, &#39;NAME_OF_THE_WIDGET&#39;)<br>
 &nbsp; &nbsp; &nbsp; self.page=self.notebook.insert_page(widget &nbsp; &nbsp;, None, 0)<br>
<div class="Ih2E3d"> &nbsp; &nbsp; &nbsp; self.notebook.set_current_page(self.page)<br>
<br>
</div><div class="Ih2E3d">FWIW, if you need to toplevel window from the second glade file too<br>
you can do something like this:<br>
<br>
</div><div class="Ih2E3d">def show_newOrganisation(self,widget):<br>
 &nbsp; &nbsp; &nbsp; <a href="http://new_org.org" target="_blank">new_org.org</a>()<br>
 &nbsp; &nbsp; &nbsp; self.gladefile_newOrg = &quot;new_org.glade&quot;<br>
 &nbsp; &nbsp; &nbsp; self.wTreenewOrg = gtk.glade.XML(self.gladefile_newOrg)<br>
</div><div class="Ih2E3d"> &nbsp; &nbsp; &nbsp; self.page = self.wTreenewOrg.get_child()<br>
 &nbsp; &nbsp; &nbsp; self.page.reparent(self.notebook)<br>
 &nbsp; &nbsp; &nbsp; self.page.set_tab_label_text(self.page, &#39;some tab label&#39;)<br>
<br>
Regards,<br>
<br>
Andi<br>
<br>
On Sat, Jan 10, 2009 at 7:54 AM, anusha k &lt;<a href="mailto:anuhacks@gmail.com">anuhacks@gmail.com</a>&gt; wrote:<br>
</div><div><div></div><div class="Wj3C7c">&gt; hi,<br>
&gt;<br>
&gt; I am using glade and pygtk to develop an accounting software.In that we have<br>
&gt; two glade files .first glade file contain the main window and the note book<br>
&gt; and the second glade contains the another window .I want to add the second<br>
&gt; glade-window as a page to first glade-window.how to do this<br>
&gt; I have the code as below.but it is giving the warning and the window is not<br>
&gt; shown up .warnings are :<br>
&gt; How to solve the warnings.Is there any other way to solve this<br>
&gt; Warnings:****************************************************************************<br>
&gt;<br>
&gt; self.wTree = gtk.glade.XML(self.gladefile)<br>
&gt; main.py:47: GtkWarning: gtk_notebook_set_tab_label: assertion `GTK_IS_WIDGET<br>
&gt; (child)&#39; failed<br>
&gt; &nbsp; self.wTree = gtk.glade.XML(self.gladefile)<br>
&gt; main.py:20: GtkWarning: Can&#39;t set a parent on a toplevel widget<br>
&gt;<br>
&gt;<br>
&gt; self.page=self.notebook.insert_page(self.wTreenewOrg.get_widget(&quot;window_new_org&quot;)<br>
&gt; , None, 0)<br>
&gt; main.py:20: GtkWarning: gtk_widget_set_child_visible: assertion<br>
&gt; `!GTK_WIDGET_TOPLEVEL (widget)&#39; failed<br>
&gt;<br>
&gt; self.page=self.notebook.insert_page(self.wTreenewOrg.get_widget(&quot;window_new_org&quot;)<br>
&gt; , None, 0)<br>
&gt; ***************************************************************************<br>
&gt; Code:<br>
&gt;<br>
&gt; import pygtk<br>
&gt; pygtk.require(&#39;2.0&#39;)<br>
&gt; import gtk<br>
&gt; import gtk.glade<br>
&gt; import new_org<br>
&gt; class mainmenu:<br>
&gt; &nbsp; &nbsp; def show_newOrganisation(self,widget):<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; <a href="http://new_org.org" target="_blank">new_org.org</a>()<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; self.gladefile_newOrg = &quot;new_org.glade&quot;<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; self.wTreenewOrg = gtk.glade.XML(self.gladefile_newOrg)<br>
&gt;<br>
&gt; self.page=self.notebook.insert_page(self.wTreenewOrg.get_widget(&quot;window_new_org&quot;)<br>
&gt; , None, 0)<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; self.notebook.set_current_page(self.page)<br>
&gt;<br>
&gt; &nbsp; &nbsp; def dialogQuit(self,widget):<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; self.dialog_quit = self.wTree.get_widget(&quot;dialog_quit&quot;)<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; self.dialog_quit.show()<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; self.response = self.dialog_quit.run()<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; if self.response == &#39;gtk.RESPONSE_QUIT&#39;:<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; gtk.main_quit()<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; self.window.destroy()<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; self.dialog_quit.destroy()<br>
&gt;<br>
&gt;<br>
&gt; &nbsp; &nbsp; def on_button_quit_clicked(*args):<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; gtk.main_quit()<br>
&gt;<br>
&gt; &nbsp; &nbsp; def on_button_cancel_clicked(*args):<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; self.dialog_quit.destroy()<br>
&gt;<br>
&gt; &nbsp; &nbsp; #To quit the main window<br>
&gt; &nbsp; &nbsp; def on_Mainwindow_destroy(self):<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; gtk.main_quit()<br>
&gt;<br>
&gt;<br>
&gt; &nbsp; &nbsp; def __init__(self):<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; #set the glade file<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; self.gladefile = &quot;gnukhata.glade&quot;<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; self.wTree = gtk.glade.XML(self.gladefile)<br>
&gt;<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; #get the Main Window and connect the Destroy event<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; self.window = self.wTree.get_widget(&quot;MainWindow&quot;)<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; self.window.show()<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; self.window.connect(&#39;destroy&#39;,gtk.main_quit)<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; self.notebook = self.wTree.get_widget(&quot;notebook_main&quot;)<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; self.notebook.show()<br>
&gt;<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; self.menuitem_quit = self.wTree.get_widget(&quot;menuitem_quit&quot;)<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; self.menuitem_quit.connect(&#39;activate&#39;,self.dialogQuit)<br>
&gt;<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; self.menuitem_newOrg =<br>
&gt; self.wTree.get_widget(&quot;menuitem_new_organisation&quot;)<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; self.menuitem_newOrg.connect(&#39;activate&#39;,self.show_newOrganisation)<br>
&gt; if __name__ == &quot;__main__&quot;:<br>
&gt; &nbsp; &nbsp; mm=mainmenu()<br>
&gt; &nbsp; &nbsp; gtk.main()<br>
&gt;<br>
&gt; Thanks in advance<br>
&gt;<br>
&gt; Njoy the share of Freedom,<br>
&gt; Anusha<br>
&gt;<br>
</div></div><div><div></div><div class="Wj3C7c">&gt; _______________________________________________<br>
&gt; pygtk mailing list &nbsp; <a href="mailto:pygtk@daa.com.au">pygtk@daa.com.au</a><br>
&gt; <a href="http://www.daa.com.au/mailman/listinfo/pygtk" target="_blank">http://www.daa.com.au/mailman/listinfo/pygtk</a><br>
&gt; Read the PyGTK FAQ: <a href="http://faq.pygtk.org/" target="_blank">http://faq.pygtk.org/</a><br>
&gt;<br>
_______________________________________________<br>
pygtk mailing list &nbsp; <a href="mailto:pygtk@daa.com.au">pygtk@daa.com.au</a><br>
<a href="http://www.daa.com.au/mailman/listinfo/pygtk" target="_blank">http://www.daa.com.au/mailman/listinfo/pygtk</a><br>
Read the PyGTK FAQ: <a href="http://faq.pygtk.org/" target="_blank">http://faq.pygtk.org/</a><br>
</div></div></blockquote></div><br>