RE: capturing output from running process crashes gtk2



I played around with it a bit, and wondered why you wanted to capture
STDERR.
On my scanimage, I get messages to STDERR only if I use batch-mode, and
it's
prompt for new material requests. If I don't use batch mode, and use
backticks,

I have an HP OfficeJet 5510 scanner/printer/fax. It has an automatic document feeder, but sane does not 
recognise when it has run out of sheets to scan. I use the simple --batch mode of scanimage, which gives you 
feedback on which page it has scanned/is scanning.

If you use IPC::Open3, you can get some good results. The only glitch

Ah. I didn't know about that. Thanks for the info and the sample code. However, I still have the Gtk2 problem 
of any processing blocking the dialog.

Here is my test code. I want the dialog to be displayed and the label to be updated by the while loop. 
However, as listed, the dialog is never displayed. And of course if I make it model and add $dialog->run, 
then the while loop never gets run.

What am I doing wrong?

#!/usr/bin/perl -w

use strict;
use Gtk2 -init;

my $dialog = Gtk2::Dialog->new ("Scanning...", undef,
                                'destroy-with-parent',
                                'gtk-cancel' => 'cancel');
my $label = Gtk2::Label->new ("Scanning...");
$dialog->vbox->add ($label);

my $scanning = 1;

$dialog->signal_connect (response => sub { $_[0]->destroy; $scanning = 0 });

print "Before call\n";
$dialog->show_all;
#$dialog->run;
print "After call\n";

my $i = 0;
while ( $scanning ) {
 $label->set_text("Scanning page ".(++$i)."...");
print "Scanning page ".$i."...\n";
 sleep 5;
}

#Gtk2->main;

exit( 0 );



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