listbox.pl
来自「perl learn perl by examples」· PL 代码 · 共 20 行
PL
20 行
use Tk;
$top = MainWindow->new();
$wine_list = $top->Listbox("-width" => 20, "-height" => 5
)->pack();
$wine_list->insert('end', # Insert at end, the following list
"Napa Valley Chardonnay", "Cabernet Sauvignon",
"Dry Chenin Blanc", "Merlot",
"Sangiovese");
$wine_list->bind('<Double-1>', \&buy_wine);
sub buy_wine {
my $wine = $wine_list->get('active');
return if (!$wine);
print "Ah, '$wine'. An excellent choice\n";
# Remove the wine from the list
$wine_list->delete('active');
}
MainLoop();
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?