Dear Monks, I have a perl/tk application that uses graphviz to plot a graph.
my $gv = $root->Scrolled('GraphViz', -background => '#B0C0FF', -scrollbars=>'se', ) ->pack (-side=>'top',-expand =>1, -fill=>'both');
All is well except that what I'd like is that when a user resizes the window, the graph displayed should be "layedout" again so that it adjusts to the size of the window. I first tried to bind the '<Configure>' event to the canvas this way:
my $canvas = $gv->Subwidget("canvas'); $canvas->bind('<Configure>', sub { my $w = shift; print $w->Width . " and " . $w->Heig +ht . "\n"; &redo_layout(); };
But nothing happens! I the binding is not used and the Subwidget returns an undefined "$canvas". So I modified the above code to bind the root window with Configure as in:
$root->bind('<Configure>', sub { my $w = shift; print $w->Width . " and " . $w->Heig +ht . "\n"; &redo_layout(); };
This works! But the behavior is not great. The graph layout does adjust but is a very "flickery" way. And strangely, window resize prints a lot of values for width and height when the bound subroutine is called. What can I do to make this a nice user experience? Why can't I bind '<Configure>' to the subwidget "canvas'? Thank you in advance.

In reply to perl tk graphviz by dlal66

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.