
- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Underline Text in Tkinter Label widget
Tkinter label widgets can be styled using the predefined attributes and functions in the library. Labels are useful in place of adding text and displaying images in the application. Sometimes, we need to style the font property of Label Text such as fontfamily, font-style (Bold, strike, underline, etc.), font-size, and many more. If we want to make the label text underlined, then we can use the underline property in the font attribute.
Example
#Import the required library from tkinter import* #Create an instance of tkinter frame win= Tk() #Define geometry of the window win.geometry("750x250") #Create a Label widget label= Label(win, text= "Hey, How're you?", font= ('Helvetica 15 underline')) label.pack() win.mainloop()
Output
Running the example code will make the text label underlined. In fact, we can remove the underline property just by removing it from the font values.
- Related Questions & Answers
- Python Tkinter – How do I change the text size in a label widget?
- How to update a Python/tkinter label widget?
- How to highlight text in a tkinter Text widget?
- How to get the Tkinter Label text?
- Changing Tkinter Label Text Dynamically using Label.configure()
- How to update the image of a Tkinter Label widget?
- How do I center the text in a Tkinter Text widget?
- Underline text with CSS
- Add advanced features to a tkinter Text widget
- Printing a list to a Tkinter Text widget
- Get the text of a button widget in Tkinter
- How to create hyperlink in a Tkinter Text widget?
- Undo and redo features in a Tkinter Text widget
- Select all text in a Text widget using Python 3 with tkinter
- How to set the height/width of a Label widget in Tkinter?
Advertisements