use strict; use warnings; use Win32::GUI(); our $NumberOfLinesDrawn = 0; my $Win = new Win32::GUI::Window( -left => 0, -top => 0, -width => 500, -height => 400, -name => "Window", -text => "drawing a line", ##-onPaint => \&Draw, ); $Win->Show(); Draw(); Win32::GUI::Dialog(); sub Window_Terminate { return -1; } sub Draw { my $DC = $Win->GetDC; my $x = 0; my $y = 0; for(1..300) {$y +=1; $x +=1; $DC->SetPixel($x,$y); } ##$DC->Validate(); $NumberOfLinesDrawn +=1; print "$NumberOfLinesDrawn\n"; } #### -onPaint => \&Draw ##and $DC->Validate(); #### use warnings; use strict; use Tk; my $mw = MainWindow->new; my $x = 0; my $y = 0; my $counter=0; our $NumberOfLinesDrawn = 0; my $c = $mw->Canvas(-width => 500, -height => 500); $c ->pack; for(1..300) {$y +=1; $x +=1; $c -> createText( $x, $y, -fill => 'red', -text => '.'); } $mw->update; $NumberOfLinesDrawn +=1; print "$NumberOfLinesDrawn\n"; MainLoop;