更改应用程序和任务栏图标 - Python/Tkinter [英] Changing the application and taskbar icon - Python/Tkinter

查看:84
本文介绍了更改应用程序和任务栏图标 - Python/Tkinter的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在编写一个非常简单的 python/tkinter 脚本(一个 .pyw 文件),我想更改它的应用程序图标(资源管理器窗口中显示的文件"图标和 start/所有程序窗口,例如 - 不是文件类型"图标,也不是应用程序图标的主窗口)和任务栏图标(应用程序最小化时显示在任务栏上的图标).是否可以更改它们,还是只有当您通过 .exe 有效安装应用程序时才可行?

I've been working on a very simple python/tkinter script (a .pyw file) and I'd like to change it's application icon (the 'file' icon shown at the explorer window and the start/all programs window, for example - not the 'file type' icon nor the main window of the app icon) and the taskbar icon (the icon shown at the taskbar when the application is minimized). Is it possible to change them or is it something only doable when you effectively install an application through an .exe?

这个小应用程序应该只在 Windows XP/7 机器上运行,它是在 Python 2.7.3 中.

This little app is supposed to run on Windows XP / 7 machines only and it's in Python 2.7.3.

提前致谢!

推荐答案

Windows 上的另一个选项如下:

Another option on Windows would be the following:

在您的 python 代码中添加以下内容:

To your python code add the following:

import ctypes

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

这篇关于更改应用程序和任务栏图标 - Python/Tkinter的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆