#!/usr/bin/perl -w #3.14159265358979 use Tk; my $MainWindow = MainWindow->new(); my $Canvas = $MainWindow->Canvas(); #$MainWindow->bind('', \&Hallo); $MainWindow->bind('', \&Hallo); #$Canvas->createText(100,100,-tags => 'Text', -text => $text); $Canvas->pack(-expand => 'yes', -fill => 'both'); MainLoop; sub Hallo { $text = $Canvas->geometry(); $Canvas->delete(Text); $Canvas->createText(100,100,-tags => 'Text', -text => $text); $xm = 250; $ym = 250; $r = 30; $Canvas->createOval($xm - $r,$ym - $r,$xm + $r,$ym + $r, -tags =>'A'); for($i=0; $i<=3.14159265358979*6; $i=$i+0.01) { $x1=(30+20)*cos($i)-20*cos((30+20)*$i/20); $x2=(30+20)*cos($i+0.01)-20*cos((30+20)*($i+0.01)/20); $y1=(30+20)*sin($i)-20*sin((30+20)*$i/20); $y2=(30+20)*sin($i+0.01)-20*sin((30+20)*($i+0.01)/20); $xP=50*cos($i); $yP=50*sin($i); $xm = 250 + $xP; $ym = 250 + $yP; $r = 20; $Canvas->delete(B); $Canvas->delete(radius); $Canvas->createOval($xm - $r,$ym - $r,$xm + $r,$ym + $r, -tags =>'B'); $Canvas->createLine($xm, $ym, $x2+250, $y2+250, -tags => 'radius'); $Canvas->createLine($x1+250, $y1+250, $x2+250, $y2+250, -tags => 'zykloid'); $MainWindow->update; } }