Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3284694
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T20:10:59+00:00 2026-05-17T20:10:59+00:00

I have a label sitting on a frame which is updated periodically to show

  • 0

I have a label sitting on a frame which is updated periodically to show the status of the application. Periodically, the name of the item being processed will not fit into the window, and with the way I currently have the label configured the window expands to accomidate the label.

Ideally, I’d like way to smartly truncate the text on the label (and then expand if someone expands the window). Is there an easy way to accomplish this?

Practically speaking, how can I just stop the window to expanding based on changes to text in the label?

Edit:

This is an aproximation of the code I’m working on that is not exhibiting the desired behavior (there is a link at the bottom to the actual code file):

r = tk.Tk()               
statusFrame = tk.Frame(r, relief=tk.SUNKEN, borderwidth=2)
statusFrame.pack(anchor=tk.SW, fill=tk.X, side=tk.BOTTOM)
statusVar = tk.StringVar()       
statusVar.set("String")                   
tk.Label(statusFrame, textvariable=statusVar).pack(side=tk.LEFT)
statusVar.set("this is a long text, window size should remain the same")

Actual code available here.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T20:11:00+00:00Added an answer on May 17, 2026 at 8:11 pm

    The answer depends very much on the way you currently have configured the widget.

    For example, I can get the desired functionality as such:

    >>> import Tkinter as tk
    >>> r=tk.Tk()
    >>> r.title('hello')
    ''
    >>> l= tk.Label(r, name='lbl', width=20, text='reduce the window width')
    >>> l.pack(fill=tk.BOTH) # or tk.X, depends; check interactive resizing now
    >>> l['text']= "This is a long text, window size should remain the same"
    

    Tell us what you do in your code for a more precise (appropriate for your code) answer.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a label function like : private function formatDate (item:Object, column:DataGridColumn):String { var
I have one label field and three buttons with the name of red, yellow,
I have a WxPython frame containing a single item, such as: class Panel(wx.Panel): def
I am making an invoicing application. I have a label (lblCost) inside of a
I have some Label controls sitting on Panel controls on a Form. I want
The following code should allow me to have the label and input field sitting
I have a View which I want to have a label and 2 buttons
I have RGB for setting colour of my label it is like this R-:0
I have a Label, whose content is displayed by a while loop. when i
I have a label that is sometimes empty. How do I set up a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.