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?
#1
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.
Reply
#2
you can use a tuple as shown here :
padding one side
Reply
#3
Try using padx, pady options when creating a label:
label = tk.Label(canvas,text="text here",padx = 10 , pady = 10 ) 
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  tkinter: Image to Label Maryan 10 314 Oct-29-2020, 01:48 PM
Last Post: joe_momma
  Tkinter: How to assign calculated value to a Label LoneStar 7 389 Sep-03-2020, 08:19 PM
Last Post: LoneStar
  changing tkinter label from thread nanok66 3 675 Jun-07-2020, 01:37 AM
Last Post: nanok66
  [Tkinter] Tkinter custom widget styling and creating custom theme karolp 6 989 May-06-2020, 06:11 PM
Last Post: karolp
  Tkinter calendar widget scratchmyhead 4 884 May-03-2020, 07:01 PM
Last Post: scratchmyhead
  [Tkinter] tkinter How to pass label fiilename to another module? johnjh 0 478 Apr-17-2020, 11:34 PM
Last Post: johnjh
  [PyGUI] Python 3.8.1 Tkinter Widget stete change sasiap 4 511 Feb-14-2020, 10:38 AM
Last Post: sasiap
  Restoring Tkinter widget background to original color pythonprogrammer 1 732 Dec-16-2019, 04:59 AM
Last Post: woooee
  Make Label Text background (default color) transparent using tkinter in python barry76 1 8,915 Nov-28-2019, 10:19 AM
Last Post: Larz60+
  Spacing Between two labels are very far and Top label is not in Center using Tkinter barry76 2 1,717 Jul-30-2019, 10:49 AM
Last Post: wuf

Forum Jump:

User Panel Messages

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