Hello all,<br><br>I have been trying to convert an app launched by windows (for ex. calc) into a QT Widget. In docs, I found a "find()" command which should do that. (<a href="http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qwidget.html#find">http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qwidget.html#find</a>)<br>
<br>But "find" returns a None.<br><br>Below you will find an example code for calculator app. May be I am not doing something right. <br>Any pointers please? (I am using : PyQT 4.7.1, Windows XP, Python 2.6.4)<br>
<br>Ex code:<br><br>import os , time, win32gui<br>from subprocess import Popen<br>from PyQt4 import QtGui<br>root_dir = os.environ.get("SystemRoot",r"C:\WINDOWS")<br>calc = r'%s\System32\calc.exe' % root_dir<br>
Popen(calc)<br>time.sleep(1)<br>#Get window handle of calc window<br>calc_hwnd = win32gui.FindWindow(None, "Calculator")<br>#Creat QT Application<br>a = QtGui.QApplication([])<br>mainwin = QtGui.QMainWindow()<br>
#Set QT mainwindow as parent of calc window<br>win32gui.SetParent(calc_hwnd, int(mainwin.winId()))<br>mainwin.showMaximized()<br>mainwin.show()<br>#Convert calc into QT widget<br>wgt = mainwin.find(calc_hwnd)<br>#XXX: following print gives "None"<br>
<b><span style="color: rgb(255, 0, 0);">print type(wgt)</span></b><br>a.exec_()<br><br>Thanks and wishes,<br>Mru<br>