[Glade-users] how to add window as a page to a notebook



hi,

I am using glade and pygtk to develop an accounting software.In that we have
two glade files .first glade file contain the main window and the note book
and the second glade contains the another window .I want to add the second
glade-window as a page to first glade-window.how to do this
I have the code as below.but it is giving the warning and the window is not
shown up .warnings are :
How to solve the warnings.Is there any other way to solve this
Warnings:****************************************************************************

self.wTree = gtk.glade.XML(self.gladefile)
main.py:47: GtkWarning: gtk_notebook_set_tab_label: assertion `GTK_IS_WIDGET
(child)' failed
  self.wTree = gtk.glade.XML(self.gladefile)
main.py:20: GtkWarning: Can't set a parent on a toplevel widget


self.page=self.notebook.insert_page(self.wTreenewOrg.get_widget("window_new_org")
, None, 0)
main.py:20: GtkWarning: gtk_widget_set_child_visible: assertion
`!GTK_WIDGET_TOPLEVEL (widget)' failed

self.page=self.notebook.insert_page(self.wTreenewOrg.get_widget("window_new_org")
, None, 0)
***************************************************************************
Code:

import pygtk
pygtk.require('2.0')
import gtk
import gtk.glade
import new_org
class mainmenu:
    def show_newOrganisation(self,widget):
        new_org.org()
        self.gladefile_newOrg = "new_org.glade"
        self.wTreenewOrg = gtk.glade.XML(self.gladefile_newOrg)

self.page=self.notebook.insert_page(self.wTreenewOrg.get_widget("window_new_org")
, None, 0)
        self.notebook.set_current_page(self.page)

    def dialogQuit(self,widget):
        self.dialog_quit = self.wTree.get_widget("dialog_quit")
        self.dialog_quit.show()
        self.response = self.dialog_quit.run()
        if self.response == 'gtk.RESPONSE_QUIT':
            gtk.main_quit()
            self.window.destroy()
        self.dialog_quit.destroy()


    def on_button_quit_clicked(*args):
        gtk.main_quit()

    def on_button_cancel_clicked(*args):
        self.dialog_quit.destroy()

    #To quit the main window
    def on_Mainwindow_destroy(self):
        gtk.main_quit()


    def __init__(self):
        #set the glade file
        self.gladefile = "gnukhata.glade"
        self.wTree = gtk.glade.XML(self.gladefile)

        #get the Main Window and connect the Destroy event
        self.window = self.wTree.get_widget("MainWindow")
        self.window.show()
        self.window.connect('destroy',gtk.main_quit)
        self.notebook = self.wTree.get_widget("notebook_main")
        self.notebook.show()

        self.menuitem_quit = self.wTree.get_widget("menuitem_quit")
        self.menuitem_quit.connect('activate',self.dialogQuit)

        self.menuitem_newOrg =
self.wTree.get_widget("menuitem_new_organisation")
        self.menuitem_newOrg.connect('activate',self.show_newOrganisation)
if __name__ == "__main__":
    mm=mainmenu()
    gtk.main()

Thanks in advance

Njoy the share of Freedom,
Anusha
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/glade-users/attachments/20090110/34796fa4/attachment.html 




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]