Perl/tk之font

1.pack is the most commonly used

2.The grid geometry manager has been improved greatly with the release of Tk 8.0 and subsequent porting to Perl.

3.The place geometry manager is the most tedious to use, because you have to determine exact coordinates (relative or absolute) for every single widget.

4.the form geometry manager is like a combination of pack and place .

 

pack参数

-side => 'left' | 'right' | ' top ' | 'bottom
Puts the widget against the specified side of the window or Frame
-fill => ' none ' | 'x' | 'y'| 'both'
Causes the widget to fill the allocation rectangle in the specified direction
-expand => 1 | 0
Causes the allocation rectangle to fill the remaining space available in the window or Frame
-anchor => 'n' | 'ne' | 'e' | 'se' | 's' | 'sw' | 'w' | 'nw' | ' center '
Anchors the widget inside the allocation rectangle
-after => $otherwidget
Puts $widget after $otherwidget in packing order
-before => $otherwidget
Puts $widget before $otherwidget in packing order
-in => $otherwindow
Packs $widget inside of $otherwindow rather than the parent of $widget , which is the default
-ipadx => amount
Increases the size of the widget horizontally by amount
-ipady => amount
Increases the size of the widget vertically by amount
-padx => amount
Places padding on the left and right of the widget
-pady => amount
Places padding on the top and bottom of the widget

  • Methods Associated with pack:
  1. Unpacking a widget:
    $widget->packForget( );
  2. Retrieving pack information:
    @list = $widget->packInfo( );
  3. Disabling and enabling automatic resizing:
    $widget->packPropagate(0);
  4. Listing widgets:
    @list = $parentwidget->packSlaves( );

tk之font:

Family
The actual name of the font, e.g., 'Courier' , 'Times' , and so on.
Size
The size of the font in points. The larger the size, the larger the text displayed on the screen. A point is 1/72 of an inch. Negative values are interpreted as pixels.
Weight
Determines if the font is shown boldor not. The value 'normal' means it is not shown bold, and 'bold' makes the font thicker.
Slant
Shows straight up and down if 'roman' is used, and slanted if 'italic' is used.
Underline
If the value used with -underline is true, the text will be underlined. If false, the text will not be underlined.
Overstrike
If true, a line will be drawn through the center of the text.

If you are used to working with fonts on a Unix system, you are probably

 

font使用:

(1)创建font:

$code_font = $mw->fontCreate('code', -family => 'courier',
然后进行引用:
$mw->Button(-text => "Show Code", -font => 'code');
$mw->Button(-text => "Show Code2", -font => $code_font);

-size => 12);

(2)$mw->fontConfigure($code_font, -family => 'Verdana');

-font => ['courier', '14', 'bold']
# The same thing, but more verbose:
-font => [-family => 'courier',
-size => '14',
-weight => 'bold']

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

惹不起的程咬金

来都来了,不赏点银子么

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值