- 論壇徽章:
- 0
|
本帖最后由 hypomac 于 2010-07-23 12:13 編輯
- #!/usr/bin/perl
- use strict;
- use warnings;
- use Tk;
- my $mw = MainWindow->new;
- $mw->geometry('600x400');
- my $canvas=$mw->Scrolled('Canvas',-scrollbars=>'se');
- $points="1,300,20,200,30,300,40,200";
- $canvas->createLine(1,300,20,200,30,300,40,200,-joinstyle=>'round',-smooth=>1);
- #$canvas->createLine($points,-joinstyle=>'round',-smooth=>1);
- $canvas->configure(-background=>'grey',-scrollregion=>[$canvas->bbox("all")]);
- $canvas->pack(-fill=>'both',-expand=>1);
- MainLoop;
復(fù)制代碼 用第11行的寫法沒問題,但是把坐標(biāo)點(diǎn)存在一個變量里用第12行的寫法就報錯(wrong # coordinates: expected an even number),坐標(biāo)點(diǎn)需要從文件里讀取,怎樣能解決這個問題,使用12行那樣的寫法 |
|