in reply to Graphical User Interface && Perl

Well with your code outline, I can see a problem with using backticks. What will happen, is when you open your window and start your progressbar, things will run fine until you run the backticked program. At that point, the GUI will stop updating (freeze)as the backtick is run. SO.... you have some options.

1. Run the backticked program in a thread, and signal back to the main GUI when it is done, through a shared variable, or a return value.

2. If the dhcp client puts out debug information, while it is searching, you can use a "piped open" instead of backticks, and use select or fileevent on the filehandle, and that select callback can be used to update the gui, or tell it when to quit.

3. You could run the Gtk activity mode progressbar in it's own separate thread. You would have a main script, which starts a thread with the mindless activity indicator going , then run the backticked program from the main script, and the line after it, kill and join the indicator thread.


I'm not really a human, but I play one on earth. flash japh

Replies are listed 'Best First'.
Re^2: Graphical User Interface && Perl
by turo (Friar) on Dec 27, 2005 at 08:39 UTC

    opps, i forgot ...
    I will launch a thread for controlling the progress ... Umm, its a good idea to use the ''popen'' (i didn't thought how can i make the progress bar 'progress' ... so it can be a good thing to take the output, or so, and sums up the current value of the progress bar).

    Thanks again ^_^>

    turo

    PS: I'm reading the tutorial you sent, seems to be pretty cool ...
    PSS: be carefull brother, boring and vice come together :-P ... A master like you may not have problems to find something to do; good luck!

    perl -Te 'print map { chr((ord)-((10,20,2,7)[$i++])) } split //,"turo"'