Tkinter sets its own window logo icon

tags: python  

· Tkinter sets its own window LOGO icon

  • three methods:
  1. iconbitmap
  2. tk.call
  3. iconphoto

1. iconbitmap()

iconBitmap () requires oneicoType bit graph parameters are used as window icons, and other types such as .png.jpg cannot be displayed.

import tkinter as tk

window = tk.Tk()
window.title('LookAtMyLOGO')  # Change the title name
window.geometry('400x450')  
window.iconbitmap('logo01.ico')   # Change the window icon
window.mainloop()

2. tk.cll()

TK.Call () is the interface of TKINTER to the TCL interpreter, and run the TCL command with the call method.
Set the picture that wants to be set to logo totk.PhotoImageOtherwise there will be errors: tkinter.tclerror
That is, the previous parameters are unchanged, and the final file = the subsequent string is changed to the PNG type picture you want to replace. PNG format! Intersection

import tkinter as tk

window = tk.Tk()
window.title('LookAtMyLOGO')  # Change the title name
window.geometry('400x450')  
window.tk.call('wm', 'iconphoto', window._w, tk.PhotoImage(file='logo02.png'))  
# Change the window icon

window.mainloop()

3. iconphoto()

iconphoto ().pngThe picture is set to the window logo.just .png format

import tkinter as tk

window = tk.Tk()
window.title('LookAtMyLOGO')  # Change the title name
window.geometry('400x450')  
window.iconphoto(False, tk.PhotoImage(file='logo03.png'))
# FALSE: This image uses only this window instead of the TOPLEVELS window created in the future
# Set to TRUE: It will be suitable for all TOPLEVELS windows that are later created
window.mainloop()

· existThis websiteI found the icon of Emoji to be used as the size of the logo. It would not be too confused to see what it was.You can download .png format picture directly

Intelligent Recommendation

Win10 system sets its own time format

Win10 system Click on the small icon on the right, there is no time format setting, you need to find: 1. Open ‘’Settings’’, open ‘’Time and Language’’ &...

Android sets its own application as a system application

Android emulator environment genymotion 7.0 After restarting, the apk will be installed automatically, and some permissions can be obtained, such as adjusting the system brightness Real machine mode T...

Windows sets its own program to start automatically

Windows system wants to quickly set the startup to automatically start a certain program, you can use the following methods to set: The first type: set startup items 1. Find the startup folder, mine i...

AndroidStudio sets its own signature when running

One: Open Signing under File->Project Structure->Modules and create a new Signing with any name; Or add the following code in the app's gradle, the effect is the same. 2: Add the following code ...

PyCharm sets its own default template

1.File-Settings 2.Editor- Code Style - File and Code Templates - Python Script What needs to be set can be written now, related variables refer to: 3. After setting, click ok or apply. After my collea...

More Recommendation

Tron issues its own pass (token adds logo)

Sometimes, when I see the token issued by others have its own logo, it looks very handsome~ Why don’t I have the token issued by myself? As for how to issue your own token, please refer toTron i...

qrcode library generates a QR code with its own LOGO and uploads it to Qiniu

qrcode generates a QR code with its own LOGO Library dependency origin Code Upload the generated QR code to Qiniu Library dependency origin Company Mini Program activities should be shared in the QR c...

(WSL) Linux shows its own system LOGO ---- ScreenFetch

I saw that the group friends were playing this WSL these days, just installing a Linux on Win, and then I thought to play with it, hehe. 0. How to install WSL Here I refer to the blog of technology fa...

004 Leaflet fourth demo replaces the marker icon with its own icon

1. Documents used leaflet.css jquery-1.11.1.min.js leaflet.js leaf-green.png leaf-orange.png leaf-red.png leaf-shadow.png This Liezi is quite simple. The pictures of Liezi given by the official websit...

Python3 GUI interface programming Tkinter change window default icon

Convert picture format to ico format using python First install the PythonMagick package, install directly using pip, or go to https://www.lfd.uci.edu/~gohlke/pythonlibs/#pythonmagick to download the ...

Copyright  DMCA © 2018-2026 - All Rights Reserved - www.programmersought.com  User Notice

Top