Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??


Well, i only have gtk2 and I got

GLib-GObject-WARNING **: invalid (NULL) pointer instance GLib-GObject-CRITICAL **: g_signal_connect_data: assertion `G_TYPE_CHE +CK_INSTANCE (instance)' failed ... Can't locate object method "timeout_add" via package "Gtk2" ... Usage: Gtk2::main(class)

Checking around my harddisk i see

site\lib\Gtk2\api.pod 260:=item gtk_timeout_add => Glib::Timeout->add 262:=item gtk_timeout_remove => Glib::Source->remove


So this is what finally works, you should try swapping Gtk2/Gtk3 and see if it works for you :)

#!/usr/bin/perl -- use strict; use warnings; # use Gtk2; use Gtk2 -init; my $window = Gtk2::Window->new ('toplevel'); my $button = Gtk2::Button->new ('Quit'); $button->signal_connect (clicked => sub { Gtk2::main_quit }); $window->add ($button); $window->show_all; my $data = 'data'; # my $id = Gtk2->timeout_add(1000, \&handler, $data); my $id = Glib::Timeout->add(1000, \&handler, $data); Gtk2->main; sub handler { my ($data) = @_; print "timed out ... @_\n"; # return 1 if you want the handler to be called again later # return 0 to stop the handler from being called again return 1; } __END__

In reply to Re^5: Can GTK3 be driven externally? by Anonymous Monk
in thread Can GTK3 be driven externally? by holandes777

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others imbibing at the Monastery: (2)
    As of 2021-01-24 01:49 GMT
    Find Nodes?
      Voting Booth?