Python Tkinter GUI Set Titlebar Icon Image Using Iconphoto() Method Full Tutorial For Beginners

Python Tkinter GUI Set Titlebar Icon Image Using Iconphoto() Method Full Tutorial For Beginners

 

Welcome folks today in this post we will be setting the titlebar icon image using iconphoto() method using tkinter in python. All the full source code of the application is shown below.

 

 

Get Started

 

 

In order to get started you need to make an app.py file and copy paste the following code

 

app.py

 

# Importing Tkinter module
from tkinter import *
from tkinter.ttk import *

# Creating master Tkinter window
master = Tk()

# Creating object of photoimage class
# Image should be in the same folder
# in which script is saved
p1 = PhotoImage(file='newlikeButton.png')

# Setting icon of master window
master.iconphoto(False, p1)

# Creating button
b = Button(master, text = 'Click me !')
b.pack(side = TOP)

# Infinite loop can be terminated by
# keyboard or mouse interrupt
# or by any predefined function (destroy())
mainloop()

 

See also  Python 3 Script to Monitor Website URL Changes - Website Monitoring Full Python Script for Beginners

Now just replace the path of the image and then if you execute the python script by typing the below command

 

python app.py

 

See also  Python 3 Script to Capitalize First Character of String Using Upper() and Capitalize() Methods Full Tutorial For Beginners

 

 

Leave a Reply