[pygtk] delete-event with multiple windows from different classes???

Jeremy Moles jeremy at emperorlinux.com
Thu Oct 20 20:59:18 WST 2005


I can't think of a really easy to do it--there's a gtk.WindowGroup
object that might be better, but...

As long as you keep a container of "handles" to these windows, just make
the encompassing Window's call them iteratively:

windowlist = (window1(), window2(), window3())

foo.connect("delete-event", self.DeleteAllWindows)

def DeleteAllWindows(self, widget):
	for w in windowlist:
		w.delete()

Am I misunderstanding what you're asking? :)

On Thu, 2005-10-20 at 09:43 -0700, Chris Irish wrote:
> Hi all,
>   Let me setup my question real quick...... If I have four python 
> classes and within each of these classes I have a different GUI window 
> being created.  Meaning I have all the widget creation and functionality 
> of each GUI within their respective class.  Then I import these four 
> classes into another class making a instance of each imported class and 
> calling the gtk main loop to start everything.
> 
> So far so good. But how do you handle delete-events when working with 
> multiple windows from different classes?  Is there a default way you're 
> suppose to handle things?  For example, how can I have all the windows 
> close and the main loop quit by closing one of the imported windows?  
> Right now when I close a window, just that window closes but the rest of 
> the program keeps going.
> 
> Thanks in advance for any help,
> Chris
> _______________________________________________
> pygtk mailing list   pygtk at daa.com.au
> http://www.daa.com.au/mailman/listinfo/pygtk
> Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/



More information about the pygtk mailing list