Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Pretty much every GUI toolkit supports building windows without entering the event loop. Here is tk example</p> <pre><code>#!/usr/bin/perl -- use strict; use warnings; use Tk; my $mw = tkinit(); my $ca = $mw-&gt;Canvas( background =&gt; 'white' )-&gt;pack(qw/-expand 1 -fill both /); $mw-&gt;geometry( '500x600+10+10' ); for my $cc ( { red =&gt; \&amp;red, green =&gt; \&amp;der, blue =&gt; \&amp;erd }, { green =&gt; \&amp;red, red =&gt; \&amp;der, blue =&gt; \&amp;erd }, { green =&gt; \&amp;red, blue =&gt; \&amp;der, red =&gt; \&amp;erd }, ) { $ca-&gt;delete('all'); my %color = %$cc; for my $fill ( keys %color ) { my $red = $color{$fill}; for my $t ( 10 .. 220 ) { my $d = 0.1; my ( $x, $y ) = $red-&gt;( $t, 0.1 ); $_ += 250 for $x, $y; $ca-&gt;createOval( $x, $y, ( $t * 2 * $d ) + $x, ( $t * 2 * $d ) + $y, -fill =&gt; $fill, ); $mw-&gt;update; select undef, undef, undef, 0.001; } $mw-&gt;update; } } Tk::DoOneEvent(0) while Tk::MainWindow-&gt;Count; ## MainLoop; exit 0; sub red { my ( $t, $d ) = @_; my $x = $t * sin( $t * $d ); my $y = $t * cos( $t * $d ); $x, $y; } sub der { my ( $t, $d ) = @_; my $x = $t * sin( $t * $d ); my $y = $t * cos( $t * 2 * $d ); $x, $y; } sub erd { my ( $t, $d ) = @_; my $x = $t * sin( $t * 2 * $d ); my $y = $t * cos( $t * $d ); $x, $y; } __END__ </code></pre> <p>Both Gtk2 and Wx support the same thing, its either update/show/display ... and the windows get drawn, and when you want user interaction, you call MainLoop or run the app or handle it yourself, its just a while loop dispatching pending events</p> <pre><code>wxTheApp-&gt;Dispatch while wxTheApp-&gt;Pending; Gtk2-&gt;main_iteration while Gtk2-&gt;events_pending; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload