简体   繁体   中英

PyWin32: Windows Classic theme

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 containing python.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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM