Python Forum
Tkinter - How can I extend a label widget? - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/Forum-Python-Coding)
+--- Forum: GUI (https://python-forum.io/Forum-GUI)
+--- Thread: Tkinter - How can I extend a label widget? (/Thread-Tkinter-How-can-I-extend-a-label-widget)



Tkinter - How can I extend a label widget? - TurboC - Oct-06-2020

maybe it's a simple question, but I can't find a solition.

below an image. by default a label widget has 3 blank pixels placed on each side for the padding. my question is, how can I extend this padding just on the right size?

[Image: 6e2c8a1355825089.jpg]

keep in mind that the label can change its context (just the text), so this padding, for example 5 pixel, must be the same for each kind of label.


RE: Tkinter - How can I extend a label widget? - joe_momma - Oct-13-2020

you can use a tuple as shown here :
padding one side


RE: Tkinter - How can I extend a label widget? - zazas321 - Oct-13-2020

Try using padx, pady options when creating a label:
label = tk.Label(canvas,text="text here",padx = 10 , pady = 10 )