#!/usr/bin/perl -w use strict; use Tk; use threads; # Create main window sub gui { my $main = MainWindow->new; # Add a Label and a Button to main window $main->Label(-text => 'Hello, world!')->pack; $main->Button(-text => 'Quit', -command => [$main => 'destroy'] )->pack; # Spin the message loop MainLoop; } my $server_thread = threads->create("gui"); while (1) { sleep(1); print "cav\n"; }
janitored by ybiC: Balanced <code> tags around code block, as per Monastery convention
In reply to Making a TK GUI in a thread by cavalive
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |