Python GUI Tutorial - 30 - Fonts | Tkinter

preview_player
Показать описание
In this video, you're going to learn how we can use font in our tkinter program to show our text in different style.
The Font class in Tkinter provides us various options to decorate our text.

Example in video -

from tkinter import *

root = Tk()

my_font = Font(family="Times New Roman", size=16, weight="bold", slant="italic", underline=1, overstrike=1)
label = Label(root, text= "Tech-Gram Academy", font=my_font).pack()

---------------------------------------------------------------------

So there are 6 options there to decorate the text

1. family = Which font family we're going to use.
2. size = take a number as size
3. weight = set it to "bold" to make text bold
4. slant = set it to "italic" to make text italic
5. underline = Used to draw underline.
6. overstrike = to make text strike.

available fonts families -
Noto Sans Mono CJK TC
Lohit Kannada
Samyak Devanagari
Century Schoolbook L
OpenSymbol
Khmer OS System
Nakula
Chandas
Keraleeyam
Noto Sans Mono CJK TC
Mukti Narrow
Meera
Kalimati
KacstQurn
Gubbi
Noto Sans Mono CJK SC
Tibetan Machine Uni
Umpush
DejaVu Sans Mono
Purisa
Pothana2000
Noto Serif CJK JP
KacstBook
KacstLetter
Noto Serif CJK KR
Noto Sans CJK SC
Norasi
Loma
Karumbi
KacstDigital
KacstTitleL
mry_KacstQurn
URW Palladio L
Noto Serif CJK SC
Noto Serif CJK TC
Likhan
Padauk Book
Phetsarath OT
Sawasdee
Sahadeva
Noto Sans CJK TC
Tlwg Typist
Tlwg Typewriter
Samyak Tamil
Noto Sans CJK KR
URW Gothic L
Dingbats
URW Chancery L
Ubuntu
Noto Sans CJK JP
Noto Sans CJK SC
Chilanka
FreeSerif
Lohit Assamese
Padauk
AnjaliOldLipi
Ubuntu Condensed
Samyak Gujarati
ori1Uni
KacstOffice
DejaVu Sans
Kinnari
KacstArt
Lohit Odia
Tlwg Mono
aakar
Bitstream Charter
KacstOne
Mitra Mono
Kalapi
Khmer OS
Courier 10 Pitch
Laksaman
Liberation Sans Narrow
Liberation Mono
Nimbus Sans L
padmaa-Bold.1.1
Manjari
Noto Sans CJK TC
Ani
Rachana
Pagul
Lohit Telugu
Lohit Tamil Classical
Samanata
Droid Sans Fallback
Vemana2000
San Francisco Display
Standard Symbols L
Lohit Gujarati
KacstPen
SFNS Display
RaghuMalayalam
KacstDecorative
Nimbus Mono L
Liberation Serif
Manjari
Lohit Malayalam
LKLUG
Noto Sans Mono CJK SC
Nimbus Roman No9 L
Ubuntu
KacstPoster
Liberation Sans
Manjari
Mukti Narrow
FreeSans
Noto Sans Mono CJK JP
Sarai
Lohit Devanagari
Noto Color Emoji
Uroob
Noto Mono
KacstNaskh
Dyuthi
Lohit Tamil
Tlwg Typo
Noto Sans CJK JP
KacstFarsi
Suruma
Lohit Bengali
Abyssinica SIL
Jamrul
Noto Sans Mono CJK KR
Waree
KacstTitle
padmaa
DejaVu Serif
Saab
Noto Sans CJK KR
Navilu
Gargi
Noto Sans Mono CJK KR
Garuda
Samyak Malayalam
Rekha
KacstScreen
Lohit Gurmukhi
FreeMono
Ubuntu Mono
URW Bookman L
Noto Sans Mono CJK JP

i am sure your queries like-

- How we can change the size of text in tkinter?
- change size of the text in tkinter?
- how to make text bold in tkinter?
- how to make text italic in tkinter?
- how to make text underlined in tkinter?
- how to make striked next in tkinter?
have been solved.

if you have any problem related with this video then please comment below. we'll reply as soon as possible -

contact us on-
Рекомендации по теме
Комментарии
Автор

не очень хорошо говорю на английском, но даже я поняла... это шикарно! спасибо! вы один из лучших, однозначно!

scarllet.
Автор

really best video tutorials. simple and easily understandable.

manishsharmatnt
Автор

How can I get fonts which are not there in the library !? I wanted to use Sloan and Optician Sans font for my project but it just sets the default font family whenever I use Sloan or Optician Sans

SakarSubedi
Автор

Hey, all the videos are really helpful. Thankyou.

rutujadarak
Автор

How can I change the style of some part of the text...?

gauravbhasme
Автор

Hi, my text is showing in normal font. Can u help me?

root = Tk()

my_font = Font(family='Samyak Devanagari', size=16)
cx1 = Label(root, text="Digite seu nome.", font=my_font).pack()

root.mainloop()

nicholas_eras
Автор

Hello Sir, how can i fix to different font color of tkinter Entry box

mabhabbairagy
Автор

How to use devnagiri font for pdf genration

AdnanKhan-ryqf
Автор

I want to change the font of title, how can I do?

pattanrafi
Автор

down_text = Text(new_window, font=('Arial', 11, 'bold' ) how do i create the underlined text in this ?

kalpeshrawal
Автор

sir ji how can we use hindi or gujarati fonts use ?

akcandlestick
Автор

all fonts are looking the same. showing sharp pixels also

ganeshs
Автор

it should be forbidden for indians to set titles in English if the video is not in english

onatdeviren