> We'd like to use threads in one of our Linux GTK Wx GUI's.  The  
> purpose of the thread is to check some text files for changes 
> every 2  
> seconds. 

Hi Mike,

I use Wx::Timer, which is wonderful and doesn't degrade performance.  I use
it to update status of controls during media playing (I don't use the
standard toolbar).

I do use threads, but the only information I get back is whether it has
completed or not, but it works fine although a little more complicated than
Timer.

Good luck.

Steve

Abbreviated example.

At start of program:

#
# Wx::Timer
#
        $i_frame->{TIMER} = Wx::Timer->new( $i_frame, 1 );
        $i_frame->{TIMER}->Start( 200 );




Then later on:


sub on_timer {
#
#       subroutine to perform periodic processing
#
        my( $i_frame, $event ) = @_;
        my $time_in_msecs;                              
        my $time_in_secs;

######## update slider control position
#################################################
        if ($gl_media_control_available == 1){
# If wxMediaCtrl available
                $time_in_msecs=$i_frame->{Ctl_Media}->Tell();
# Obtains the current position in time within the movie in milliseconds.
                $time_in_secs=$time_in_msecs/1000;
                $i_frame->{Ctl_Media_Slider_Sld}->SetValue($time_in_secs);
# Set slider to video position in secs.

                my $length_in_secs=($i_frame->{Ctl_Media}->Length())/1000;
# Only works after a 'play' command.
                my $ss = $length_in_secs % 60;
                if (length($ss) == 1) {$ss = "0" . $ss}
# zero-pad seconds
                my $loc_length_hhhss = int($length_in_secs / 60) . ":" . $ss
;
                
                $ss = $time_in_secs % 60;
                if (length($ss) == 1) {$ss = "0" . $ss}
# zerp pad seconds
                my $loc_time_hhhss = int($time_in_secs / 60) . ":" . $ss ;
                
                $i_frame->{Ctl_Media_Slider_End_Lbl}->SetLabel("
".$loc_time_hhhss."/".$loc_length_hhhss); # Set max video length in mm:ss.
        }

}

Reply via email to