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 7183737
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T18:03:16+00:00 2026-05-28T18:03:16+00:00

I have question on limiting the resizing the text Tk widget. I have the

  • 0

I have question on limiting the resizing the text Tk widget. I have the following code with two text widgets lined up on top of each other. The problem is when I resize the text widget containing “Box2” just disappears as shown in images below.

I want to do resizing such that “Box2” is also seen. If at certain stage of resizing if “Box2” can’t be shown then resizing to a smaller size should be disallowed (though resizing to a bigger size should be allowed).

Normal sizeThis the normal sized one

Resized Here "Box2" text widget disappears

The code to reproduce the problem is:

#----------------------------------------------
# scrolled_text from Brent Welch's book
#----------------------------------------------
proc scrolled_text { f args } {
    frame $f
    eval {text $f.text -wrap none \
        -xscrollcommand [list $f.xscroll set] \
        -yscrollcommand [list $f.yscroll set]} $args
    scrollbar $f.xscroll -orient horizontal \
        -command [list $f.text xview]
    scrollbar $f.yscroll -orient vertical \
        -command [list $f.text yview]
    grid $f.text $f.yscroll -sticky news
    grid $f.xscroll -sticky news
    grid rowconfigure $f 0 -weight 1
    grid columnconfigure $f 0 -weight 1
    return $f.text
}


proc horiz_scrolled_text { f args } {
    frame $f
    eval {text $f.text -wrap none \
        -xscrollcommand [list $f.xscroll set] } $args
    scrollbar $f.xscroll -orient horizontal -command [list $f.text xview]
    grid $f.text -sticky news
    grid $f.xscroll -sticky news
    grid rowconfigure $f 0 -weight 1
    grid columnconfigure $f 0 -weight 1 
    return $f.text
}
set st1 [scrolled_text .t1 -width 40 -height 10]
set st2 [horiz_scrolled_text .t2 -width 40 -height 2]

pack .t1 -side top -fill both -expand true
pack .t2 -side top -fill x 

$st1 insert end "Box1"
$st2 insert end "Box2"
  • 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-28T18:03:17+00:00Added an answer on May 28, 2026 at 6:03 pm

    Using grid instead of pack as suggested by schlenk works.

    set st1 [scrolled_text .t1 -width 80 -height 40]
    set st2 [horiz_scrolled_text .t2 -width 80 -height 2]
    
    grid .t1 -sticky news
    grid .t2 -sticky news
    
    # row 0 - t1; row 1 - t2
    grid rowconfigure . 0 -weight 10  -minsize 5
    grid rowconfigure . 1 -weight 2   -minsize 1
    grid columnconfigure . 0 -weight 1
    
    $st1 insert end "Box1"
    $st2 insert end "Box2"
    

    The key here is rowconfigure and the weight’s assigned to it. I have assigned 10 to .t1 and 2 to .t2 in accordance to their height values. I have also set the minsize to 5 and 1 so that we do not shrink the window beyond a certain minimum.

    The columnconfigure has weight set to 1 because if we try to resize horizontally the windows should expand and fill instead of leaving empty spaces.

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

Sidebar

Related Questions

Say I have two log files ( input.log and output.log ) with the following
My question is kinda simple... Let's suppose I have two simples tables on a
If I have a code like the following; if (x == "0") { $("input:checkbox").parent().mouseover(function
I have question about NSView: Imagine a Custom View where the mouseDown, mouseDrag and
I have question regarding the SQLAlchemy. How can I add into my mapped class
I have question regarding the use of function parameters. In the past I have
I have question concerning a function I created. I would like to show the
I have question related to what is done in SMS application is if i'm
I have question about normalization. Suppose I have an applications dealing with songs. First
We have the question is there a performance difference between i++ and ++i in

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.