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: An image and label are not appearing. emont 7 410 Mar-21-2024, 03:00 PM
Last Post: deanhystad
  TKinter Widget Attribute and Method Quick Reference zunebuggy 3 789 Oct-15-2023, 05:49 PM
Last Post: zunebuggy
  tkinter destroy label inside labelFrame Nick_tkinter 3 4,481 Sep-17-2023, 03:38 PM
Last Post: munirashraf9821
  [Tkinter] Updating Tkinter label using multiprocessing Agusms 6 3,053 Aug-15-2022, 07:10 PM
Last Post: menator01
  [Tkinter] The Text in the Label widget Tkinter cuts off the Long text in the view malmustafa 4 4,671 Jun-26-2022, 06:26 PM
Last Post: menator01
  Tkinter Exit Code based on Entry Widget Nu2Python 6 2,877 Oct-21-2021, 03:01 PM
Last Post: Nu2Python
  tkinter text widget word wrap position chrisdb 6 7,459 Mar-18-2021, 03:55 PM
Last Post: chrisdb
  tkinter: Image to Label Maryan 10 5,119 Oct-29-2020, 01:48 PM
Last Post: joe_momma
  Tkinter: How to assign calculated value to a Label LoneStar 7 3,758 Sep-03-2020, 08:19 PM
Last Post: LoneStar
  changing tkinter label from thread nanok66 3 7,215 Jun-07-2020, 01:37 AM
Last Post: nanok66

Forum Jump:

User Panel Messages

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