zoukankan      html  css  js  c++  java
  • Perl 列表框

    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 => color
    Sets the color of the area behind the text.
    设置列表框的背景颜色
    -borderwidth => amount
    Sets the width of the edges of the widget. Default is 2.
    设置列表框的边框宽度
    -cursor => cursorname
    Sets the cursor to display when the mouse is over the Listbox.
    改变鼠标放在列表框上时鼠标的形状
    -exportselection => 0 | 1
    Determines 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 => fontname
    Sets the font of any text displayed within the Listbox.
    设置文字字型
    -foreground => color
    Sets the color of nonselected text displayed in the Listbox.
    设置文字的颜色
    -height => amount
    Sets the height of the Listbox.
    设置列表框的高度
    -highlightbackground => color
    Sets the color the highlight rectangle should be when the Listbox does not have the keyboard focus.
    当列表框不是键盘输入焦点时,设定其颜色
    -highlightcolor => color
    Sets the color the highlight rectangle should be when the Listbox does have the keyboard focus.
    当列表框为键盘输入焦点时,设定其颜色
    -highlightthickness => amount
    Sets 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 => color
    Sets the color behind any selected text.
    设定被选择文字背景颜色
    -selectborderwidth => amount
    Sets the width of the border around any selected text.
    设定选取的外框的宽度
    -selectforeground => color
    Sets 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 | 1
    Turns gridding off or on for the Listbox. Default is 0.
    是否开启按网格倍数缩放窗口
    -takefocus => 0 | 1 | undef
    Determines whether the widget can have keyboard focus. 0 means never, 1 means always, undef means dynamic decision.
    庙宇是否让该列表框成为键盘输入焦点
    -width => amount
    Sets the width of the Listbox in characters. If amount is 0 or less, the Listbox is made as wide as the longest item.
    设定列表框的宽度
    -xscrollcommand => callback
    Assigns a horizontal Scrollbar to widget.
    如果将插字游标左右移动或者调整来加视窗的大小所呼叫的程序
    -yscrollcommand => callback
    Assigns a vertical Scrollbar to widget.
    如果将插字游标上下移动或者调整来加视窗的大小所呼叫的程序
    

  • 相关阅读:
    自动化测试全聚合
    选择排序(JAVA实现)
    插入排序(JAVA实现)
    冒泡排序(JAVA实现)
    快速排序(java实现)
    Python+页面元素高亮源码实例
    (原创)Python 自动化测试框架详解
    Python+requests库 POST接口图片上传
    基于Python + requests 的web接口自动化测试框架
    python 创建mysql数据库
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13351886.html
Copyright © 2011-2022 走看看