Perl 列表框

来源:互联网 发布:扎古头扭蛋可动眼编程 编辑:程序博客网 时间:2024/06/05 15:51
use Tk; my $mw = new MainWindow;$lb = $mw->Listbox(-selectmode => "single")->pack( ); $lb->insert('end', qw/red yellow green blue grey/);##绑定到左键<Button-1>$lb->bind('<Button-1>', sub { $lb->configure(-background => $lb->get($lb->curselection( )) ); }); MainLoop列表框参数:-background => colorSets the color of the area behind the text.设置列表框的背景颜色-borderwidth => amountSets the width of the edges of the widget. Default is 2.设置列表框的边框宽度-cursor => cursornameSets the cursor to display when the mouse is over the Listbox.改变鼠标放在列表框上时鼠标的形状-exportselection => 0 | 1Determines if the current Listbox selection is made available for the X selection as well. If set to 1, prevents two Listboxes from having selections at the same time.设置选择构造,如果设置为了,防止两个listbox同时被选择-font => fontnameSets the font of any text displayed within the Listbox.设置文字字型-foreground => colorSets the color of nonselected text displayed in the Listbox.设置文字的颜色-height => amountSets the height of the Listbox.设置列表框的高度-highlightbackground => colorSets the color the highlight rectangle should be when the Listbox does not have the keyboard focus.当列表框不是键盘输入焦点时,设定其颜色-highlightcolor => colorSets the color the highlight rectangle should be when the Listbox does have the keyboard focus.当列表框为键盘输入焦点时,设定其颜色-highlightthickness => amountSets the thickness of the highlight rectangle. Default is 2.设定焦点的宽度,默认值为2-relief => 'flat'|'groove'|'raised'|'ridge'|'sunken'|'solid'Sets the relief of the edges of the Listbox.设定输入列表框3D效果-selectbackground => colorSets the color behind any selected text.设定被选择文字背景颜色-selectborderwidth => amountSets the width of the border around any selected text.设定选取的外框的宽度-selectforeground => colorSets the color of the text in any selected items. 17设定被选择文字的颜色-selectmode => "single" | "browse" | "multiple" | "extended"Affects how many items can be selected at once; also affects some key/mouse bindings for the Listbox (such as Shift-select).设定选择模式-setgrid => 0 | 1Turns gridding off or on for the Listbox. Default is 0.是否开启按网格倍数缩放窗口-takefocus => 0 | 1 | undefDetermines whether the widget can have keyboard focus. 0 means never, 1 means always, undef means dynamic decision.庙宇是否让该列表框成为键盘输入焦点-width => amountSets the width of the Listbox in characters. If amount is 0 or less, the Listbox is made as wide as the longest item.设定列表框的宽度-xscrollcommand => callbackAssigns a horizontal Scrollbar to widget.如果将插字游标左右移动或者调整来加视窗的大小所呼叫的程序-yscrollcommand => callbackAssigns a vertical Scrollbar to widget.如果将插字游标上下移动或者调整来加视窗的大小所呼叫的程序

0 0
原创粉丝点击