Labels are the main method of placing non-editable text in windows. For example, label can be used as a title placed next to entry widget. Some of the important features of the label are –
- The selection of labels can be done using
Gtk.Label.set_selectable(). Selectable labels allow the user to copy the contents to the clipboard. Labels contain useful information to copied such as error messages that can be made as a selectable label.
- Label text justification and word-wrapping are possible by the methods
Gtk.Labelsupports clickable hyperlinks. The markup for links is borrowed from HTML, using the a with
hrefand title attributes. GTK+ renders links similar to the way they appear in web browsers, with colored, underlined text.
- Mnemonics are the underlined characters in the label, used for keyboard navigation; can be created by giving a string with an underscore before the mnemonic character, such as “_Geeks For Geeks” to the function
To create a label follow the below steps:
- import GTK+ 3 module.
- Create main window.
- Create a Box.
- Implement Label.
- Implement Button.
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.