<br>hi Andi,<br>I tried your second solution.But it is giving the error:'glade.XML' object has no attribute 'get_child'<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"><<a href="mailto:albrecht.andi@googlemail.com">albrecht.andi@googlemail.com</a>></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'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>
<a href="http://new_org.org" target="_blank">new_org.org</a>()<br>
self.gladefile_newOrg = "new_org.glade"<br>
</div> widget = gtk.glade.XML(self.gladefile_newOrg, 'NAME_OF_THE_WIDGET')<br>
self.page=self.notebook.insert_page(widget , None, 0)<br>
<div class="Ih2E3d"> 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>
<a href="http://new_org.org" target="_blank">new_org.org</a>()<br>
self.gladefile_newOrg = "new_org.glade"<br>
self.wTreenewOrg = gtk.glade.XML(self.gladefile_newOrg)<br>
</div><div class="Ih2E3d"> self.page = self.wTreenewOrg.get_child()<br>
self.page.reparent(self.notebook)<br>
self.page.set_tab_label_text(self.page, 'some tab label')<br>
<br>
Regards,<br>
<br>
Andi<br>
<br>
On Sat, Jan 10, 2009 at 7:54 AM, anusha k <<a href="mailto:anuhacks@gmail.com">anuhacks@gmail.com</a>> wrote:<br>
</div><div><div></div><div class="Wj3C7c">> hi,<br>
><br>
> I am using glade and pygtk to develop an accounting software.In that we have<br>
> two glade files .first glade file contain the main window and the note book<br>
> and the second glade contains the another window .I want to add the second<br>
> glade-window as a page to first glade-window.how to do this<br>
> I have the code as below.but it is giving the warning and the window is not<br>
> shown up .warnings are :<br>
> How to solve the warnings.Is there any other way to solve this<br>
> Warnings:****************************************************************************<br>
><br>
> self.wTree = gtk.glade.XML(self.gladefile)<br>
> main.py:47: GtkWarning: gtk_notebook_set_tab_label: assertion `GTK_IS_WIDGET<br>
> (child)' failed<br>
> self.wTree = gtk.glade.XML(self.gladefile)<br>
> main.py:20: GtkWarning: Can't set a parent on a toplevel widget<br>
><br>
><br>
> self.page=self.notebook.insert_page(self.wTreenewOrg.get_widget("window_new_org")<br>
> , None, 0)<br>
> main.py:20: GtkWarning: gtk_widget_set_child_visible: assertion<br>
> `!GTK_WIDGET_TOPLEVEL (widget)' failed<br>
><br>
> self.page=self.notebook.insert_page(self.wTreenewOrg.get_widget("window_new_org")<br>
> , None, 0)<br>
> ***************************************************************************<br>
> Code:<br>
><br>
> import pygtk<br>
> pygtk.require('2.0')<br>
> import gtk<br>
> import gtk.glade<br>
> import new_org<br>
> class mainmenu:<br>
> def show_newOrganisation(self,widget):<br>
> <a href="http://new_org.org" target="_blank">new_org.org</a>()<br>
> self.gladefile_newOrg = "new_org.glade"<br>
> self.wTreenewOrg = gtk.glade.XML(self.gladefile_newOrg)<br>
><br>
> self.page=self.notebook.insert_page(self.wTreenewOrg.get_widget("window_new_org")<br>
> , None, 0)<br>
> self.notebook.set_current_page(self.page)<br>
><br>
> def dialogQuit(self,widget):<br>
> self.dialog_quit = self.wTree.get_widget("dialog_quit")<br>
> self.dialog_quit.show()<br>
> self.response = self.dialog_quit.run()<br>
> if self.response == 'gtk.RESPONSE_QUIT':<br>
> gtk.main_quit()<br>
> self.window.destroy()<br>
> self.dialog_quit.destroy()<br>
><br>
><br>
> def on_button_quit_clicked(*args):<br>
> gtk.main_quit()<br>
><br>
> def on_button_cancel_clicked(*args):<br>
> self.dialog_quit.destroy()<br>
><br>
> #To quit the main window<br>
> def on_Mainwindow_destroy(self):<br>
> gtk.main_quit()<br>
><br>
><br>
> def __init__(self):<br>
> #set the glade file<br>
> self.gladefile = "gnukhata.glade"<br>
> self.wTree = gtk.glade.XML(self.gladefile)<br>
><br>
> #get the Main Window and connect the Destroy event<br>
> self.window = self.wTree.get_widget("MainWindow")<br>
> self.window.show()<br>
> self.window.connect('destroy',gtk.main_quit)<br>
> self.notebook = self.wTree.get_widget("notebook_main")<br>
> self.notebook.show()<br>
><br>
> self.menuitem_quit = self.wTree.get_widget("menuitem_quit")<br>
> self.menuitem_quit.connect('activate',self.dialogQuit)<br>
><br>
> self.menuitem_newOrg =<br>
> self.wTree.get_widget("menuitem_new_organisation")<br>
> self.menuitem_newOrg.connect('activate',self.show_newOrganisation)<br>
> if __name__ == "__main__":<br>
> mm=mainmenu()<br>
> gtk.main()<br>
><br>
> Thanks in advance<br>
><br>
> Njoy the share of Freedom,<br>
> Anusha<br>
><br>
</div></div><div><div></div><div class="Wj3C7c">> _______________________________________________<br>
> pygtk mailing list <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>
><br>
_______________________________________________<br>
pygtk mailing list <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>