Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: how to write a vertical TK Entry?

by Marshall (Canon)
on Mar 05, 2020 at 11:54 UTC ( [id://11113845]=note: print w/replies, xml ) Need Help??


in reply to how to write a vertical TK Entry?

Ok, I took another stab at this... It's been a very, very long time since I did Tk.

This code provides 5 vertical entry fields which can be edited (that's what you can do to an entry field as opposed to a label or a button). You press the 'Print Values' button to see the edited values of these entry windows. I omitted the pack() details which can specify width, etc and also wrap around if desired. Tweaking these details can be time consuming.

The main point here is whether or not I have the general idea of what you wanted?

use strict; use warnings; use Tk; use Data::Dumper; my $mw = MainWindow->new(); my @entry_refs; foreach (qw (1 2 3 4 5) ) { push @entry_refs, create_entry_object ($mw, "Default Value is: $_" +, ); } $mw->Button(-text => 'Print Values', -command => \&list_entries)->pack +(); MainLoop; sub list_entries { print "\n"; foreach my $ref (@entry_refs) { print "$$ref\n"; } } sub create_entry_object { my $window = shift; my $text_var = shift; $window->Entry(-textvar => \$text_var )->pack; return \$text_var; }
Update: I looked back at this code and it appears to me that you need some Label objects to the left of the "ENTRY" objects. Take a stab at that and let us know how you are doing.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11113845]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (8)
As of 2024-04-19 08:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found