The command $widget -> create type options is used to make different structures A few examples are given
below For more information read the manual
Example
#!/usr/local/bin/perl
use Tk;
# Main Window
my $mw = new MainWindow;
my $cns = $mw -> Canvas(-relief=>"sunken", -background=>"blue");
$cns -> create('polygon',5,100,50,5,150,5,200,100,5,100,
-joinstyle=>"bevel", -fill=>"red", -outline=>"white", -width=>5);
$cns -> create('oval',200,100,300,200, -fill=>"green");
$cns -> create('oval',100,150,300,100, -fill=>"white", -width=>0);
$cns -> create('rectangle',10,150,100,250, -dash=&g
Canvas 图形
最新推荐文章于 2020-08-27 17:21:08 发布
这篇博客展示了如何利用Perl的Tk库创建Canvas图形,包括多边形、椭圆形和矩形。通过示例代码解释了不同图形的创建方法和选项设置,如填充颜色、轮廓样式等。
摘要由CSDN通过智能技术生成