PyWin32:Windows经典主题

在PyWin32演示文件夹中, win32gui_dialog.py示例使用经典的Windows控件。 Windows Vista主题button也可以使用PyWin32显示,如果是的话,如何? 我使用ActivePython 3.1,如果有什么区别。

样品:

PyWin32 http://img.zgserver.com/python/old.png

简短的回答:一个响亮的是。

我知道这是可能的,因为我已经看到它之前完成。 但我不完全确定它是如何完成的。

至少,你可以使用IronPython并通过使用clr来使用Windows内置的.NET框架。

如果你对IronPython不感兴趣,那么你可以考虑一下easyGUI或者TkInter的东西吗?

您需要向Python解释器添加指定ComCtl32.dll的正确版本的并行清单。 幸运的是,不需要改变解释器可执行文件本身。

  • 在包含python.exe的目录中创建一个名为python.exe.manifest的文件。
  • 将以下内容放在该文件中:
 <?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> 

您可能还想将python.exe.manifest复制到pythonw.exe.manifest

你有没有尝试使用“ winxpgui ”模块而不是“ win32gui ”模块?

我不确定是否有一个“ winvistagui ”或“ win7gui ”模块,但是“ winxpgui ”确实存在并且可以工作,因为它包含了一个清单。