Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
so in win32gui how to keep the plot from been erased when covered by other windows !!. the usual plan for this is to redraw the same line code again and again if you uncomment the lines: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"; }
but i think this is not the same way other modules or languages deals with updating the window ie by updating the pixels of the screen, in comparison the same TK code is concise and working well:-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;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: updating the window in Win32 GUI
by BrowserUk (Patriarch) on Jan 11, 2010 at 14:38 UTC | |
by Anonymous Monk on Jan 12, 2010 at 07:16 UTC | |
|
Re: updating the window in Win32 GUI
by zentara (Cardinal) on Jan 11, 2010 at 16:20 UTC |