It may be that you are not showing us enough code to reveal where the problem is.

I was intrigued by the idea of a GUI design where the geometry of certain widgets will change as a result of user (or data) activity at run-time. (Normally, it's not the sort of approach I would recommend -- consistent size and placement of widgets throughout the run-time of the GUI will tend to be an aid to consistent and correct usage. But I can imagine cases where changing the size of a widget dynamically could be useful.)

Anyway, just I wanted to see if I could change the size of a listbox easily, and it seems this is doable:

#!/usr/bin/perl use strict; use Tk; my $mw = MainWindow->new; my $btnframe = $mw->Frame()->pack(-side => 'top'); my $lstframe = $mw->Frame()->pack(-side => 'top'); my $listbox = $lstframe->Listbox(-height => 16, -width => 16)->pack; my @listdata = <DATA>; chomp @listdata; $listbox->insert( 'end', @listdata ); for (qw/5x8 10x10 16x20/) { $btnframe->Button(-text => $_, -command => [ \&resize, $listbox, $_ ], )->pack(-side => 'left'); } MainLoop; sub resize { my ( $lbox, $size ) = @_; my ( $newh, $neww ) = split( /x/, $size ); $lbox->packForget; $lbox->configure(-height => $newh, -width => $neww ); $lbox->pack; } __DATA__ 1234567890123456 ABCDEFGHIJK 1234567890 abcdefghi 12345 stuv foo bar baz junk extra lines last line with no blank following

That's just a simple proof-of-concept, to show that a callback routine (such as would be invoked by a Button widget) can reconfigure the dimensions of a listbox widget.

So the question would be: what is in your code (or missing from your code) that makes it different from this simple example?


In reply to Re: Tk configure problem by graff
in thread Tk configure problem by Grygonos

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.