For this beginner python Tkinter video we are adding unto the topic of styling in labels. The following topics are going to be discussed:
1 - Precedence in styling Tkinter Labels
Although we can always use the Style class in order to create styling configurations, some labels need to drift away from the general template applied on the GUI. This is where the configure method is important. This method will allow you to have a specific style applied to the widget that you are using. It will also override the styling configuration from the Style class if you decide to switch the template in configure.
2 - Width in Tkinter Labels
Width will allow you to change the size of your label only in the horizontal direction. Width is relative the font size you give to your label. The units of width are simply text units and not pixels. So even though two labels have the same width, the font size is what truly determines the final size of the label.
3- Wraplength in Tkinter Labels
Labels usually do not have much text on them. But if you decide to have one you can always use the wraplength property to set a line length before your text goes into another line. The units for wraplength are in pixels and it determines how long a line of text should be before moving unto the next one.
4- Anchor in Tkinter Labels
Anchor is noticeable if your label becomes larger. It follows the same directions as sticky:
North (top) : your text will appear at the top of your label
Center: your text will appear in the middle of your label
South (bottom): your text will appear at the bottom
West (left): your text will appear on the left.
East (right): your text will appear on the right.
You also have the 4 corners available by simply anchoring to NW, NE, SW, and SE.
5 - Justify in Tkinter Labels
Justify is a very common functionality. It will set your text to start writing a new line from the center, left or right just like in microsoft word or google docs.
Leave a like, comment and subscribe !
На этой странице сайта вы можете посмотреть видео онлайн Python Tkinter - Creating Labels and Styling - Part 2 длительностью часов минут секунд в хорошем качестве, которое загрузил пользователь Thinking Through Code 21 Май 2022, поделитесь ссылкой с друзьями и знакомыми, на youtube это видео уже посмотрели 1,906 раз и оно понравилось 66 зрителям. Приятного просмотра!