Hi, One of the things I love about Python is the ability to create a new class and with just a few lines of test code, use it either as a stand alone program or as something imported into another program. I am having trouble doing that with pygtk.
I have a class called acct. Upon running its __init__ routine, it opens a window that contains a clist that contains a bunch of names and account numbers. A user can select one of the names/acct#'s and then click on the OK button, and self.acct will be set to the acct# selected, and the window will close. I use mainloop() to get things running and mainquit() to close the window. This works fine as a stand alone program with some test code that creates an instance of the acct class and then prints the acct# selected. But when I import this into another Python program that opens its own window, I have 2 problems. The first is that when the window created by the acct class closes by calling its mainquit(), the window from the calling program closes and the calling program terminates also. I tried using hide() on the window from the acct class. This apparently works OK when it is imported into another program but when run as a stand alone program, I have to kill the python process to get it to terminate. The gtk docs from http://developer.gnome.org/doc/API/2.0/gtk/gtk-general.html#gtk-main-quit indicates that main() / mainquit() can be nested. Is this not true for pygtk? The second problem is letting the calling program know when the window from the acct class closes so that it can do something with self.acct. Am I going about this the wrong way? I would like to keep the acct class separate from the calling class as I can use the acct class in many other programs. I hope I haven't confused everyone as much as apparently I am confused. Thanks. Gary [EMAIL PROTECTED] _______________________________________________ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
