drwxrwxrwx has asked for the wisdom of the Perl Monks concerning the following question:

Hi... i'm going crazy with perl/tk i can't set width and height of my entries.... what i should do?

i'm using this
$entryvar=$main->Entry(-text => "var")->grid(-column => n, -row => n); $entryvar->configure(-width => n, -height => n);

2004-03-11 Edit by Corion: Moved from Perl Monks Discussion, added code tags
2004-03-12 Edit by castaway: Changed title from 'perl/tk !'

Replies are listed 'Best First'.
Re: Text widget width and height problems with Perl/Tk
by crabbdean (Pilgrim) on Mar 12, 2004 at 00:17 UTC
    How can you set the height on a text entry field? The answer, you can't! You can only set the width. The module description page for tk::entry doesn't list "height" as an option. These pages are the best reference for what a widget can and can't do.

    UPDATE: I should add the "configure" method can only configure options that are a subset of the widget class you are working on. It can't configure for options that don't belong to that class.

    Have fun!

    Dean
    Programming these days takes more than a lone avenger with a compiler. - sam
    A Standard for the Transmission of IP Datagrams on Avian Carriers
Re: Text widget width and height problems with Perl/Tk
by zentara (Cardinal) on Mar 12, 2004 at 01:11 UTC
    Like crabdean said, you can't set the height of the Entry widget's entry box, but if you are trying to fill space, it can be done with ->pack(-fill=>both, -expand=>1)

    I'm not really a human, but I play one on earth. flash japh
      i would try to show a big amount of data in an entry so i can't use the normal height you think i should set the height of my mainwindow and fill the the space?
Re: Text widget width and height problems with Perl/Tk
by Plankton (Vicar) on Mar 11, 2004 at 21:22 UTC
    What's up with n? Are you sure you don't mean $n?

    Plankton: 1% Evil, 99% Hot Gas.
      I'm assuming that n is drwxrwxrwx's way of meaning any integer. If you do a
      use Tk::Pretty; @config = $entryvar->configure; print Pretty @config;
      what results do you get for width and height? Try to use specific, unique examples for us like
      $entryvar=$main->Entry(-text => "var")->grid(-column => 10, -row => 5) +; $entryvar->configure(-width => 30, -height => 20);

      - - arden.

        yes n is an integer :> i apologize!!...
        mhmh... it says that -height is a bad option... so i cant's set the height of my entries it'impossible :°
Re: Text widget width and height problems with Perl/Tk
by halley (Prior) on Mar 12, 2004 at 15:12 UTC
    If you want a -height, are you sure you don't want a multi-line text area? I chopped this from a piece of working code. It uses the Scrolled widget which then creates a Text widget inside.
    # Scrollable text area. my $scroll = $parent->Frame(-borderwidth => 2, -relief => 'ridge') ->pack(-expand => 1, -fill => 'both'); my $text = $scroll->Scrolled('Text', -scrollbars => 'e', -width => 81, -height => 20) ->pack(-expand => 1, -fill => 'both');

    --
    [ e d @ h a l l e y . c c ]

      yes halley that's i was looking for... i didn't try to use the text widget thanks a lot :D

      i'm a luser :°°°°°