Python Forum
Tkinter - How can I extend a label widget?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Tkinter - How can I extend a label widget?
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.
you can use a tuple as shown here :
padding one side
Try using padx, pady options when creating a label:
label = tk.Label(canvas,text="text here",padx = 10 , pady = 10 ) 

Possibly Related Threads…
Thread Author Replies Views Last Post
  tkinter text widget word wrap position chrisdb 6 1,922 Mar-18-2021, 03:55 PM
Last Post: chrisdb
  tkinter destroy label inside labelFrame Nick_tkinter 2 1,113 Feb-24-2021, 03:31 AM
Last Post: deanhystad
  tkinter: Image to Label Maryan 10 1,584 Oct-29-2020, 01:48 PM
Last Post: joe_momma
  Tkinter: How to assign calculated value to a Label LoneStar 7 1,077 Sep-03-2020, 08:19 PM
Last Post: LoneStar
  changing tkinter label from thread nanok66 3 2,498 Jun-07-2020, 01:37 AM
Last Post: nanok66
  [Tkinter] Tkinter custom widget styling and creating custom theme karolp 6 2,168 May-06-2020, 06:11 PM
Last Post: karolp
  Tkinter calendar widget scratchmyhead 4 1,957 May-03-2020, 07:01 PM
Last Post: scratchmyhead
  [Tkinter] tkinter How to pass label fiilename to another module? johnjh 0 884 Apr-17-2020, 11:34 PM
Last Post: johnjh
  [PyGUI] Python 3.8.1 Tkinter Widget stete change sasiap 4 984 Feb-14-2020, 10:38 AM
Last Post: sasiap
  Restoring Tkinter widget background to original color pythonprogrammer 1 1,313 Dec-16-2019, 04:59 AM
Last Post: woooee

Forum Jump:

User Panel Messages

Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020