Create Application Title And Icon In Python GUI

Introduction

 
In this blog, I am going to create an application title and set an app icon in a Python GUI application. When a user opens the application it will display the title with the icon on the application screen.
 
Software requirement
 
Python 3.5 and IDLE (Python 3.5)
 
Programming code
  1. #Create App icon in Python GUI Application  
  2. import tkinter as tk  
  3. from tkinter import ttk  
  4. app = tk.Tk()  
  5. #Application Title  
  6. app.title("Python GUI App with icon")  
  7. #Set App icon  
  8. app.iconbitmap(r'C:\Users\prakashraj\Downloads\py1.ico')  
  9. #Calling Main()  
  10. app.mainloop()  
About the code
 
  • First, I am importing the tkinter modules.
  • Next, I assign a class and variables.
  • Next, I create an application title and set an app icon.
  • Finally, I have started the windows event loop by calling the mainloop method then execute the code.
Icon 
 
 
Output(App without title & icon)
 
 
 
Output(App with title & icon)