Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

Hi
I have written a per tk script, which first create a mainwindow and then starts a server program and client program. But the problem is if I shift the 'MainLoop' statement in the end of the script after the initiation of server and client , then the gui is not appearing although the server is getting started.
On the other hand if I put the 'MainLoop' before the server and client initiation statements then the gui is starting , but the execution control only goes to the server-client statement only after closing the gui. All I want is that the gui should start and simultaneously the server and client should also start in sequence.
For the server and client code you can refer to my code pasted in How to introduce threading in socket communication. Similar code is getting executed in Server::initServer() and Client::initClient() routines respectively.

## my script ##

use Tk; use Server; use Client; my $mw = MainWindow->new(); #MainLoop; #gui appears but the control goes below only after clos +ing the gui,hence server does not start when the gui is open print "after mainloop \n"; my $server = Server->new(parentWnd=>$mw); $server->initServer(); my $client = Client->new(parentWnd=>$mw); $client->initClient(); MainLoop; #does not bring up the gui but the server starts.

In reply to tk mainwindow not appearing by simonz

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (6)
As of 2024-04-19 11:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found