How to use Unicode and Special Characters in Tkinter?


Sometimes we need to add unicode and special charset in our Tkinter application. We can add unicode characters in our labels or widgets concatenating the signature as, u ‘/<Unicode of Character>’. You can find the list of all unicode characters from here

In this example, we will add a unicode character in the button widget.

Example

# Import the required Libraries
from tkinter import *

#Create an instance of tkinter frame
win= Tk()
win.geometry("700x200")

#Create a button

Button(win, text='Click'+u'\u01CF', font=('Poppins bold',
10)).pack(pady=20)

#Keep running the window or frame
win.mainloop()

Output

Running the above code will create a button with a unicode character (u01CF).

Updated on: 06-Mar-2021

808 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements