Open In App

How to use Unicode and Special Characters in Tkinter ?

Prerequisite: 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 easiest way to create GUI applications. 



In this article, we will learn how to use  Unicode & Special Characters in Tkinter.

Approach:



Syntax: u’\u {Unicode value}’

Example:

for "Not sign" unicode value is "00AC"

Input
u'\u00AC'

Output
¬

Below is the Implementation:-




# Import Tkinter
from tkinter import *
 
# Create Object
root = Tk()
 
# Set geometry
root.geometry("100x200")
 
# Unicodes values
unicodes_values = [
'\u00A1',
'\u00A2',
'\u00A3',
'\u00A4',
'\u00A5',
'\u00A6',
'\u00A7'
]
 
# Iterate through all unicode values
for unicodes_value in unicodes_values:
    Label(root, text = u'{unicodes_value}'.format(
      unicodes_value = unicodes_value)).pack()
 
# Execute Tkinter
root.mainloop()

 
 

Output:

 

 

Article Tags :