Re: Running Gtk2-Perl from a C program



* muppet <scott asofyet org> [2005-02-12 15:40]:
I want to figure out a way to run perl code from a GTK+ C application.
so...  I can do things like make signal handlers...  in perl...
so most code would be written in C, but some could be handled by perl code...
I also want to discuss how practical that would be
I know Gimp does it.  as a way to allow users to make extensions.
that interface seems a little convoluted.
it seems like something simpler should be possible

FWIW, I've done this with a Perl-enabled gtk+2 Vim. There's no
provision for Gtk2-Perl extensions specifically to my knowledge;
it's just a gtk+2 app with an embedded Perl interpreter. This
works:

    :perl use Gtk2;
    :perl $::win=Gtk2::Window->new;
    :perl $::win->set_title('test');
    :perl $::win->set_default_size( 200, 100 );
    :perl my $bt=Gtk2::Button->new( 'clickme' ); $bt->signal_connect( clicked => sub { VIM::Msg('you clicked 
me!') } ); $::win->add( $bt );
    :perl $::win->show_all;

Clicking the button produces the 'you clicked me!' text in Vim's
status line.

Regards,
-- 
#Aristotle
*AUTOLOAD=*_=sub{s/(.*)::(.*)/print$2,(",$\/"," ")[defined wantarray]/e;$1};
&Just->another->Perl->hacker;



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