tkinter和customtinter中的自定义任务栏图标



如何在tkintercustomtkinter中获得自定义的任务栏图标?

我试过了:

# Importing customtkinter as ctk
import customtkinter as ctk
# Creating the root window
root = ctk.CTk()
# Creating the root's title
root.title('test')
# Setting window icon
root.iconbitmap('CMyDirecoryMyFolderfavicon.ico')
# How can I set the taskbar icon?

我尝试了PyCharm给我的所有建议,但都没有奏效。

不幸的是,这不是一个选项。如果你想要一个任务栏图标,你必须将你的.py文件导出到一个带有你想要的图标的.exe文件中。然后它将显示在任务栏上的右侧图标上。

一个简单的解决方案:

root.iconbitmap('C:MyDirecoryMyFolder\favicon.ico')

最新更新