in reply to a perl tkx GUI
Mwahahahaha
#!/usr/bin/perl -- use strict; use warnings; $Tkx::TRACE = 64; use Tkx; Tkx::package_require("Tktable"); my $mw = Tkx::widget->new("."); my %hash = ( # data to display '1,0' => 'Vertical', '2,0' => 'Lng', '3,0' => 'Lateral', '0,1' => 'Expected shifts (A)', '0,2' => 'Shifts based on img alignment (B)', '0,3' => '|A-B|', ); my $t = $mw->new_table ( -rows => 4, -cols => 4, -cache => 1, -variable => \%hash, ); $t->g_pack(-fill => 'both', -expand => 1); $mw->new_button( -text => 'Populate', -command => sub { my( $r, $c ) = ( $t->cget('-rows') , $t->cget('-cols') ); for my $rr ( 0 .. $r ){ for my $cc ( 0 .. $c ){ $t->set("$rr,$cc", "yo $rr, $cc oy" ); } } return; }, )->g_pack; $b=$mw->new_button (-text=>"Finish", #~ -command=>sub {RecordData()}, -command=>sub { RecordData(); #~ $mw->destroy; # err #~ $mw->Tkx::destroy; #~ http://docs.activestate.com/activeperl/5.16/lib/Tkx.html #~ http://docs.activestate.com/activeperl/5.16/lib/Tcl/tkkit.html #~ http://docs.activestate.com/activetcl/8.5/tktable/tkTable.html #~ pathName get first ?last? #~ Returns the value of the cells specified by the table indices first + and (optionally) last in a list. use Data::Dump; dd[ $t->configure ]; dd[ Tkx::SplitList( $t->configure ) ]; dd[ $t->cget('-rows') , $t->cget('-cols') ]; #~ dd[ $t->cget ]; dd[ $t->get( qw/ topleft bottomright / ) ]; #~ my $cols = $t->cget('-cols'); for my $row ( 0 .. $t->cget('-rows') ){ #~ dd[ $t->get( "$row.0, $row.$cols" ) ]; #~ bad table index "0.0, 0.4": must be active, anchor, end, origin, to +pleft, bottomright, @x,y, or <row>,<col> #~ dd [ map { $t->get( "$row,$_" ) } $t->cget('-cols') ]; dd [ map { $t->get( "$row,$_" ) } 0 .. $t->cget('-cols') +]; } $mw->g_destroy; }, ); $b->g_pack(); sub RecordData() { # save the data input in the table to a file }; Tkx::MainLoop();
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: a perl tkx GUI
by USCG360D (Initiate) on May 29, 2013 at 00:26 UTC | |
by Anonymous Monk on May 29, 2013 at 04:13 UTC | |
by USCG360D (Initiate) on May 29, 2013 at 17:01 UTC | |
by Anonymous Monk on May 30, 2013 at 04:35 UTC |