[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    Re: [PyKDE] Proper way to show multiple windows?
From:       Ingo Krabbe <i.krabbe () dokom ! net>
Date:       2003-01-26 7:38:45
[Download RAW message or body]

On Sat, Jan 25, 2003 at 07:30:43AM -0800, star gazer wrote:
> Ken,
>  
> I did the isModal() check and it returned 0 but using
> nw.show() does not leave the window up it just flashes
> away.  If I use nw.exec_loop() then the window stays
> up but I can't open another on.  This was so easy to
> do in wxpython.  It must be as easy here I just can't
> figure it out
> 
> SG

Using a used to tool (wxpython) should always be simple, but it isn't
very hard to do a modal dialog in PyQt too !

That the window flashes is because you might create a local instance,
which is destroyed at function exit !!!

You have to store your window either in a global reference or put it
into a list of known windows, where you can delete it once you don't
need it anymore (that's what I do).

def open_modal_window(self):
	self.controlledServers.append( ServerControlOv( self,
					self, "Server Control", 0, 0) )
	x = len(self.controlledServers)-1
	self.controlledServers[x].show()

It is quite easy to use container facilities of python.  But most
applications will be happy with static allocation:

dialogA=None
def open_modal_window(parent, control):
	global dialogA
	dialogA = ServerControlOv( parent, control,
		"Server Control", 0, 0) )
	dialogA.show()

Anyway you have to use a variable that lives longer than your open
function.

_______________________________________________
PyKDE mailing list    PyKDE@mats.gmd.de
http://mats.gmd.de/mailman/listinfo/pykde
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic