in reply to Making a TK GUI in a thread
Seeing how the above works, I believe Tk would be considered thread friendly. You may wish to consider using Thread::Use.#!/usr/bin/perl -w use strict; use threads; # Create main window sub gui { require Tk; 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 Tk->MainLoop; } my $server_thread = threads->create("gui"); while (1) { sleep(1); print "cav\n"; }
PS - Please read the About the PerlMonks FAQ (the section on formatting your post).
| MJD says "you can't just make shit up and expect the computer to know what you mean, retardo!" | |
| I run a Win32 PPM repository for perl 5.6.x and 5.8.x -- I take requests (README). | |
| ** The third rule of perl club is a statement of fact: pod is sexy. |
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Making a TK GUI in a thread
by cavalive (Novice) on Sep 19, 2003 at 04:00 UTC | |
by PodMaster (Abbot) on Sep 19, 2003 at 04:29 UTC |