In the PyWin32 demos folder, the win32gui_dialog.py sample 开发者_如何转开发uses the classic windows controls. Can the Windows Vista themed buttons also be displayed using PyWin32, and if so, how? I'm using ActivePython 3.1, if that makes any difference.
Sample:
PyWin32 http://imagespark.net/files/old.png
Short answer: a resounding YES.
I know that this is possible because I have seen it being done before. but I am not entirely certain as to how it is done.
At the very least, you can use IronPython and use Windows' builtin .NET framework by wielding clr.
If you are not interested in IronPython, then might you consider something along the lines of easyGUI or TkInter?
You'll need to add a side-by-side manifest specifying a correct version of ComCtl32.dll to the Python interpreter. Fortunately there is no need to change the interpreter executable itself.
- Create a file named
python.exe.manifest
in the directory containingpython.exe
. - Put the following contents in that file:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> <assemblyIdentity processorArchitecture="x86" version="5.1.0.0" type="win32" name="python.exe"/> <description>Python</description> <dependency> <dependentAssembly> <assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" publicKeyToken="6595b64144ccf1df" language="*" processorArchitecture="x86"/> </dependentAssembly> </dependency> </assembly>
You may want to copy python.exe.manifest
to pythonw.exe.manifest
too.
Have you tried using 'winxpgui
' module instead of 'win32gui
' module?
I'm not sure if there's a 'winvistagui
' or 'win7gui
' module, but 'winxpgui
' does exist and may work, as it has a manifest included.
精彩评论