#!/usr/bin/perl # -*- mode: cperl; coding: utf-8; -*- use strict; use warnings; use utf8; use lib "/h/hamren/src/post/lib", "."; my $rval = do "common.pm" || die "$0: common.pm failed ($!) [$@]"; #--- Single-line common initializer #--- End of header sub qqq($) { return i("@_"); } my $Worker = qqq("Worker"); post( header(), p(read_main_redgreenblue_article("Python and Tk")), p("This example uses Tk for the GUI, but not for handling events on the sockets."), p("The sockets are handled by coroutines, added in Python 3.5.", " It does not blend perfectly with Tk. Some less-than-ideal code was needed:"), ul("Tk's «update()» routine is called at regular intervals to keep the GUI running.", "When the GUI is about to close, because the window close button (created by the window manager) has been clicked, ". " a delayed )five milliseconds ) call to «loop.close()» is used, so that the event loop is drained."), p("Surely there are better solutions. One obvious would be to skip coroutines, and go down a more traditional route."), p("Tk is used by several implementations: Perl, Python and Tcl."), h2("The source code"), source_file("./redgreenblue.py.source"), footer() ); __END__