在 PyQt 中使用 Windows 7 任务栏功能
我正在寻找有关将一些新的 Windows 7 任务栏功能集成到我的 PyQt 应用程序中的信息。
具体来说,如果已经存在使用新进度指示器的可能性(请参阅此处< /a>)和快速链接(www.petri.co.il/wp-content/uploads/new_win7_taskbar_features_8.gif)。
如果有人可以提供一些链接或只是“尚未实施”,我将非常感激。
多谢。
I am looking for information on the integration of some of the new Windows 7 taskbar features into my PyQt applications.
Specifically if there already exists the possibility to use the new progress indicator (see here) and the quick links (www.petri.co.il/wp-content/uploads/new_win7_taskbar_features_8.gif).
If anyone could provide a few links or just a "not implemented yet", I'd be very grateful.
Thanks a lot.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
正如夸克所说,该功能不在 Qt 4.5 中,但您可以直接从 Qt 调用 Windows API。不过这需要一点工作。
新的任务栏 API 通过 COM 公开,因此您不能使用 ctypes.windll 。您需要创建一个 .tlb 文件才能访问这些函数。从 此论坛帖子,或来自 Windows SDK。将其保存到名为 TaskbarLib.idl 的文件中。
创建 .tlb 文件。您可能需要 Windows SDK,或者从其他地方获取 IDL 编译器。
加载.tlb(您需要Python的Win32扩展,http://python .net/crew/skippy/win32/Downloads.html):
创建 TaskbarList 对象。设置进度条的函数在接口ITaskbarList3中:
现在可以调用API函数了:
这是一个完整的示例脚本。
资料来源:
1
2
As quark said, the functionality is not in Qt 4.5, but you can call the windows API directly from Qt. Its a little bit of work though.
The new taskbar API is exposed through COM, so you can't use ctypes.windll . You need to create a .tlb file to access the functions. Get the interface definition for ITaskbarList from this forum post , or from the windows SDK. Save it to a file called e.g. TaskbarLib.idl .
Create the .tlb file. You'll probably need the Windows SDK, or get an IDL compiler from somewhere else.
Load the .tlb (you need the Win32 Extensions for Python, http://python.net/crew/skippy/win32/Downloads.html):
Create the TaskbarList object. The function for setting the progress bar is in the interface ITaskbarList3:
Now you can call the API functions:
Here's a complete example script.
Sources:
1
2
有一个 Qt 插件可以实现所有 Windows 7 任务栏扩展。它被称为Q7Goodies。它附带了 PyQt 绑定,因此这可能是利用 PyQt 中的 Windows 7 功能的最简单方法。
There is a Qt add-on that implements all the Windows 7 taskbar extensions. It is called Q7Goodies. It comes with a PyQt bindings, so this is probably the easiest way to take advantage of Windows 7 features in PyQt.
未在 Qt 4.5 中实现,但 在 Qt 4.6 中出现。在 Qt 4.6 正式发布之前,PyQt 不会包装 4.6,但您可以使用 4.6 快照s 或查看 Qt 存储库 并查看 C++ 版本是否支持您想要的功能。如果是的话,PyQt 4.6 也会支持它。
补充:4.6 功能列表未显示明确的内容Windows 7 支持,但这并不意味着它不会有你想要的,因为,至少如果我理解正确的话,他们很可能会将该功能折叠到现有的小部件中。
Not implemented in Qt 4.5, but in the works for Qt 4.6 it appears. PyQt won't wrap 4.6 until Qt 4.6 is officially released, but you can play with the 4.6 snapshots or checkout the Qt repository and see if the C++ version supports the features you want. If it does then PyQt 4.6 will support it as well.
Added: The list of 4.6 features doesn't show explicit Windows 7 support, but that doesn't mean it won't have what you want, since, at least if I understand correctly, its likely they would fold that functionality into the existing widget.