From: Kevin A. <al...@se...> - 2005-03-08 18:47:08
|
On Mar 5, 2005, at 3:58 AM, Liam Clarke wrote: > Hi all, > > Is there a way to call setFocus on the window when it opens? > > I have 3 windows - > > Main > | > ChildA > | > ChildB > > ChildA opens ChildB, assigns Main as the parent of ChildB and then > closes itself. This is fine except Main is now in the foreground, and > B behind it.... > > I tried self.backgrounds['bgTemplate'].setFocus(), but that doesn't > work, > I'm currently using > > def on_initialize(self, event): > self.components[self.components.keys()[0]].setFocus() > > in ChildB. > > This works, but it seems a bit hacky, and I get a flicker as Main > moves to the front, and then B does, which is distracting. > > There's probably something very obvious I'm missing, there usually is, > but any help would be appreciated. I used findfiles.py and all the > returns for 'focus' related to findFocus and setFocus being called on > widgets. > > > Regards, > > > Liam Clarke > I think the method you're looking for is the wxPython one, Raise(), which brings a "top-level" window to the front. So something like this in your main code... self.childB.Raise() ka |