Re: Gtk::Gdk::input_add and CPU racing



Hello,
Thanks so much for your help.

The simpler example is great for me because it does not matter if my GUI
freezes for a bit.

On Tue, 2003-02-25 at 13:42, Jörn Reder wrote:
 

  my $id = Gtk::Gdk->input_add(fileno(LS),['read'],\&list);

  sub list{
    while(<LS>)
    { $text->insert( $font, undef, undef, $_ );}
    Gtk::Gdk->input_remove($id);
  }

The above worked great for my little test program and thus I figured it would 
work with what I am really working on. I am running this as a sub routine called 
by $button->signal_connect( action, \&blah).   When I applied it the cpu still raced.


Here is how am actually using this(still simplified):
#####################################################

$button->signal_connect("clicked", \&do_ls);

main Gtk;
exit( 0 );

sub do_ls 
{
  open(LS, "ls 2>&1 |");
  my $id = Gtk::Gdk->input_add(fileno(LS),['read'],\&list);
}

sub list
{
  while(<LS>)
       { $statusbox->insert( $font, undef, undef, $_ );}
  Gtk::Gdk->input_remove($id);
}
####################################################

Am I taking the wrong approach?

Thanks Again

Dave



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]