From: Liam C. <cy...@gm...> - 2005-03-09 19:51:55
|
Thanks very much for that Kevin, works like a charm. Regards, Liam Clarke On Tue, 8 Mar 2005 10:47:04 -0800, Kevin Altis <al...@se...> wrote: > 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 > > -- 'There is only one basic human right, and that is to do as you damn well please. And with it comes the only basic human duty, to take the consequences. |