How to use HTML in Tkinter - Python? Last Updated : 31 Aug, 2021 Comments Improve Suggest changes Like Article Like Report Prerequisite: Tkinter Python offers multiple options for developing GUI (Graphical User Interface). Out of all the GUI methods, Tkinter is the most commonly used method. It is a standard Python interface to the Tk GUI toolkit shipped with Python. Python with Tkinter is the fastest and easiest way to create GUI applications. Creating a GUI using Tkinter is an easy task. In this article, we will learn, How we can use HTML tags in Tkinter. Here we will use the tkhtmlview Module. The tkhtmlview module is a collection of Tkinter widgets whose text can be set in HTML format. An HTML widget isn't a web browser frame, it's only a simple and lightweight HTML parser that formats the tags used by the Tkinter Text base class. Installation pip install tkhtmlview List of HTML Tags supports in tkhtmlview: abbrcodedivemh1, h2, h3, h4, h5, h6iimgli, ul, olmarkpprespanstrongu We will use HTMLLabel() class for writing HTML tags HTMLLabel(): Text-box widget with label appearance Syntax: HTMLLabel(Object Name, html="ENTER HTML CODE") Below are some examples to depict how to use HTML in Tkinter GUI. Example 1: Use heading tags. Python3 # Import Module from tkinter import * from tkhtmlview import HTMLLabel # Create Object root = Tk() # Set Geometry root.geometry("400x400") # Add label my_label = HTMLLabel(root, html=""" <h1>GEEKSFORGEEKS</h1> <h2>GEEKSFORGEEKS</h2> <h3>GEEKSFORGEEKS</h3> <h4>GEEKSFORGEEKS</h4> <h5>GEEKSFORGEEKS</h5> <h6>GEEKSFORGEEKS</h6> """) # Adjust label my_label.pack(pady=20, padx=20) # Execute Tkinter root.mainloop() Output: Example 2: Use anchor, paragraph & image tags Python3 # Import Module from tkinter import * from tkhtmlview import HTMLLabel # Create Object root = Tk() # Set Geometry root.geometry("400x400") # Add label my_label = HTMLLabel(root, html=""" <a href='https://www.geeksforgeeks.org/'>GEEKSFORGEEKS</a> <p>Free Tutorials, Millions of Articles, Live, Online and Classroom Courses ,Frequent Coding Competitions ,Webinars by Industry Experts, Internship opportunities and Job Opportunities.</p> <img src="gfg.png"> """) # Adjust label my_label.pack(pady=20, padx=20) # Execute Tkinter root.mainloop() Output:  Example 3: Use list tag and add a link to each tag Python3 # Import Module from tkinter import * from tkhtmlview import HTMLLabel # Create Object root = Tk() # Set Geometry root.geometry("400x400") # Add label my_label = HTMLLabel(root, html=""" <ul> <li><a href='https://www.geeksforgeeks.org/python-programming-language/'>Python</a></li> <li><a href='https://www.geeksforgeeks.org/c-plus-plus/'>C++</a></li> <li><a href='https://www.geeksforgeeks.org/java/'>Java</a></li> </ul> """) # Adjust label my_label.pack(pady=20, padx=20) # Execute Tkinter root.mainloop() Output: Similarly, we can use all other tags. Comment More infoAdvertise with us Next Article How to use HTML in Tkinter - Python? abhigoya Follow Improve Article Tags : Python Python-tkinter Python Tkinter-exercises Practice Tags : python Similar Reads How to Install Tkinter on Linux? Tkinter is the most popular Python library used to create GUI-based applications. The name Tkinter comes from the Tk interface. In this article, we will look into the process of installing Tkinter in a Linux system. Note: Tkinter module comes in bundled with Python, so this article can be helpful fo 2 min read What is Tkinter for Python? Tkinter is a standard Python GUI (Graphical User Interface) library that provides a set of tools and widgets to create desktop applications with graphical interfaces. Tkinter is included with most Python installations, making it easily accessible for developers who want to build GUI applications wit 2 min read How to show webcam in TkInter Window - Python Python offers various modules for creating GUI applications, out of which, Tkinter lets users do various tasks inside their app. Thus, while creating a GUI app, have you ever felt the need to let the user open the camera on a specific condition? Don't know, how to achieve that. Continue reading this 4 min read How to Install Tkinter on MacOS? In this article, we will learn how to install Tkinter in Python on MacOS. Tkinter is a Python binding to the Tk GUI toolkit. It is the standard Python interface to the Tk GUI toolkit, and is Python's de-facto standard GUI. Installation:Method 1: Using pip to install Tkinter Follow the below steps to 2 min read How to Use Entry Box on Canvas - Tkinter There are various ways of creating GUI applications in Python. One of the easiest and most commonly used ways is through the use of the Tkinter module. Tkinter offers various widgets for creating web apps.  One such widget is the Entry box, which is used to display a single line of text. Are you fac 5 min read How to Use CSS in Python Flask Flask is a popular web framework for Python that makes it easy to build web applications. One of the key elements of any web application is styling, which is where CSS (Cascading Style Sheets) comes in. CSS allows us to control the look and feel of our web pages, making them more attractive and user 3 min read Python | Add style to tkinter button Tkinter is a Python standard library that is used to create GUI (Graphical User Interface) applications. It is one of the most commonly used packages of Python. Tkinter supports both traditional and modern graphics support with the help of Tk themed widgets. All the widgets that Tkinter also has ava 4 min read How to Convert HTML to Markdown in Python? Markdown is a way of writing a formatted text on the web. This article discusses how an HTML text can be converted to Markdown. We can easily convert HTML to markdown using markdownify package. So let's see how to download markdownify package and convert our HTML to markdown in python. Installation 1 min read Validating Entry Widget In Python Tkinter When developing graphical user interfaces (GUIs) in Python, Tkinter is a powerful and widely-used toolkit that simplifies the process. One of the common tasks in GUI applications is obtaining user input through form fields. Tkinter's Entry widget is designed for this purpose, allowing users to input 7 min read How to Get the Tkinter Label Text? Prerequisite: Python GUI â Tkinter Python offers multiple options for developing a GUI (Graphical User Interface). Out of all the GUI methods, tkinter is the most commonly used method. It is a standard Python interface to the Tk GUI toolkit shipped with Python. Python with tkinter is the fastest and 2 min read Like