automation
- From: Scott Lanning <lannings who int>
- To: gtk-perl-list gnome org
- Subject: automation
- Date: Fri, 16 Sep 2005 18:46:32 +0200 (CEST)
I'm trying to figure out how to automate
a browser based on Gtk2::MozEmbed.
The problem is normally you call Gtk2->main()
and there things are stuck, but in this case
I want to be able to script when certain things
should happen rather than wait for events (I don't
even care if the window is shown). So I think I have
to not use `main'. So I'm experimenting with that.
I derived this from one of the test files:
#!/usr/bin/perl
use strict;
use warnings;
use Gtk2 '-init';
my $window = Gtk2::Object->new ("Gtk2::Window");
my $object = Gtk2::Object->new ("Gtk2::Label");
my $event = Gtk2::Gdk::Event->new ("button-press");
$event->button (1);
$event->time (time);
$event->state ([qw/shift-mask control-mask/]);
Gtk2::Gdk::Event->put ($event);
$window->add ($object);
$object->realize;
$object->propagate_event ($event);
$window->show;
my $events = 0;
while (Gtk2->events_pending) {
my $retval = Gtk2->main_iteration_do(0);
$events++;
print "event num=$events, ";
}
sleep 2;
__END__
I don't really know what the hell I'm doing, though.
Are there any more examples of this kind of thing,
or am I going about it the wrong way (if you can
tell from my crappy explanation)?
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]