Как установить значок панели задач приложения в Windows 7

Это - проблема в моем проекте также - вход заканчивается на профилировщике, сообщает довольно последовательно.

я использовал _ast модуль прежде в ветвлении PyFlakes ( http://github.com/kevinw/pyflakes )..., и определенно возможно сделать то, что Вы предлагаете в своем вопросе - осмотреть и ввести защиту перед вызовами к регистрирующимся методам (с Вашим подтвержденным протестом, что необходимо было бы сделать некоторую проверку типа выполнения). См. http://pyside.blogspot.com/2008/03/ast-compilation-from-python.html для простого примера.

Редактирование: я просто заметил MetaPython на моем канале planetpython.org - вариант использования в качестве примера удаляет операторы журнала во время импорта.

, Возможно, лучшее решение состояло бы в том, чтобы кто-то повторно реализовал вход как модуль C, но я не был бы первым для схватывания такого... возможность: p

42
задан Brown 16 July 2013 в 14:10
поделиться

1 ответ

I've found the answer, after some digging.

In Windows 7, the taskbar is not for "Application Windows" per se, it's for "Application User Models". For example, if you have several different instances of your application running, and each instance has its own icon, then they will all be grouped under a single taskbar icon. Windows uses various heuristics to decide whether different instances should be grouped or not, and in this case it decided that everything hosted by Pythonw.exe should be grouped under the icon for Pythonw.exe.

The correct solution is for Pythonw.exe to tell Windows that it is merely hosting other applications. Perhaps a future release of Python will do this. Alternatively, you can add a registry key to tell Windows that Pythonw.exe is just a host rather than an application in its own right. See MSDN documentation for AppUserModelIDs.

Alternatively, you can use a Windows call from Python, to explicitly tell Windows what the correct AppUserModelID is for this process:

import ctypes
myappid = 'mycompany.myproduct.subproduct.version' # arbitrary string
ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID(myappid)

EDIT: Please see Ronan's answer: the myappid string should be unicode.

97
ответ дан 26 November 2019 в 23:27
поделиться
Другие вопросы по тегам:

Похожие вопросы: