From: Roger E. <ro...@er...> - 2005-09-04 12:14:10
|
Gregory Piñero wrote: > I am getting this error: > > Traceback (most recent call last): > File "C:\Python23\lib\site-packages\PythonCard\widget.py", line 402, > in _dispa > tch > handler(background, aWxEvent) > File "C:\Documents and Settings\Gregory\My Documents\Get New Great > Job\JobAppl > ierMarkII\job_applier_markII.py", line 271, in on_Start_timer > win32gui.SetForegroundWindow(self.myHwnd) > pywintypes.error: (0, 'SetForegroundWindow', 'No error message is > available') > > Though it does seem to be putting my window above some windows but not > others. So maybe it's partly working? > > -Greg > > > > Here's the actual code I'm using if you're curious: > > def _MyCallback( hwnd, extra ): > extra.append(hwnd) > > def find_my_hwnd(title): > windows = [] > win32gui.EnumWindows(_MyCallback, windows) > j = 0 > winDict = {} > for i in windows: > if win32gui.IsWindowVisible(i): > if title in win32gui.GetWindowText(i): > return i > return None > > Then the pythonCard initialize routine calls: > self.myHwnd=find_my_hwnd(self.title) > > Then I have a timer function going like this: > def on_Start_timer(self, event): > if self.menuBar.getChecked('menuOptionsStayOnTop'): > win32gui.SetForegroundWindow(self.myHwnd) > What are the results of using win32gui.BringWindowToTop(self.myHwnd)? Regards, Roger |