Perl TK 抽屉式组件
发布时间:2020-12-16 00:32:11 所属栏目:大数据 来源:网络整理
导读:转自:http://bbs.chinaunix.net/thread-3591026-1-1.html #!perl -w use Tk; $mw = MainWindow-new; $mw-title( 'Tk' ); $FRAME_L = $mw-Frame-pack(qw/-side left -fill both/); $WIDGET_F = $FRAME_L-Labelframe()-pack(qw/-side top -fill both -expand
转自:http://bbs.chinaunix.net/thread-3591026-1-1.html #!perl -w use Tk; $mw = MainWindow->new; $mw->title( 'Tk' ); $FRAME_L = $mw->Frame->pack(qw/-side left -fill both/); $WIDGET_F = $FRAME_L->Labelframe()->pack(qw/-side top -fill both -expand 1/); my %section = ( A => [1,2,3],B => [4,5,6],C => [7,8,9],); my (@frames,@button); for my $sect_name (sort keys %section) { my $b; my $f = $WIDGET_F->Frame( -bg => 'green',-relief => 'sunken',-borderwidth => 1 ); $b = $WIDGET_F->Radiobutton( -text => $sect_name,-indicatoron => 0,-value => $sect_name,-width => 25,-bg => '#af1a3c6a6872',-fg => 'white',-command => sub { $_->packForget for @frames; $f->pack( -after => $b,qw/-side top -fill both -expand 1 -padx 1 -pady 1/ ); } )->pack(qw/-fill x -side top -padx 1 -pady 1/); for my $par_tmp (@{ $section{$sect_name} }) { $f->Button( -text => "$par_tmp",-relief => 'ridge',-bg => '#8189ce14cf5b',-fg => 'black',)->pack(qw/-side top -fill x -padx 4 /); } push @frames,$f; push @button,$b; } $FRAME_L->Button( -text => "CLOSE",-borderwidth => 1,-bg => "white",-fg => "black",-command => sub { exit; },)->pack(qw/-side bottom -fill x -padx 1 -pady 2 /); MainLoop; (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |