From: <gre...@gm...> - 2005-09-04 03:05:13
|
I am getting this error: Traceback (most recent call last): File "C:\Python23\lib\site-packages\PythonCard\widget.py", line 402, in=20 _dispa tch handler(background, aWxEvent) File "C:\Documents and Settings\Gregory\My Documents\Get New Great=20 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=20 available') Though it does seem to be putting my window above some windows but not=20 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 =3D [] win32gui.EnumWindows(_MyCallback, windows)=20 j =3D 0 winDict =3D {} 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=3Dfind_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) |