Hi

Today , I also was looking in to Gtk2::Ex::Graph::GD module and I do experienced graph update problem. After debugging I have solved it

Trick is you need create new Gtk2::Ex::Graph::GD object every time when you want to update GUI in Gtk

refer following code which works for me in ActivePerl 5.12 in windows 7

use strict; use warnings; use threads; use threads::shared; use Thread::Queue; use Glib qw/TRUE FALSE/; use Gtk2 -init; use Data::Dumper; use Gtk2::Ex::Graph::GD; use GD::Graph; use GD::Graph::Data; my @xlegend = (1..10); $|=1; my $gui; my $table; sub on_window1_destroy { my $widget = shift @_; #my $userData = shift @_; Gtk2->main_quit; } sub updateGraph { print "\n called"; my @data1 = map(rand(100),(1..10)); my @graph_data = (\@xlegend,\@data1,); my $data = GD::Graph::Data->new(\@graph_data) or die GD::Graph::Data-> +error; my $graph = Gtk2::Ex::Graph::GD->new(500, 300, 'lines'); my $image = $graph->get_image($data); $table->attach_defaults($image,1,2,1,2); return TRUE; } #Main Glib::Object->set_threadsafe (TRUE); $gui = Gtk2::Builder->new(); $gui->add_from_file('chart.glade'); $gui->connect_signals(undef); $table=$gui->get_object('table1'); &updateGraph(); Glib::Timeout->add (1000,\&updateGraph); Gtk2->main();

Note: Not a very good code. ONly shared for reference

Enjoy :)

In reply to Re^2: Updating Gtk2::Ex::Graph::GD by sam_bakki
in thread Updating Gtk2::Ex::Graph::GD by deadpickle

Title:
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, details, 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, summary, 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.