in reply to perl tk graphviz

I'm not sure what your problem is, but the "flicker" may be caused by Graphviz trying to rebuild it's graphics and display it at each Configure event. As you already see, the Configure event fires many times while resizing. You may be able to work out a flag, where a flag is set when the mouse button 1 is pressed, and set back to zero when the button 1 is released. Then in your Configure binding, you can return if the flag is set, thus only having Graphviz rebuild at the end of the resize. See Re: perltk autoresize following users resize for a similar hack using Enter and Leave bindings.

You might also look at the Tk::Panedwindow widget. It's perldoc says

RESIZING PANES A pane is resized by grabbing the sash (or sash handle if present) and + dragging with the mouse. This is accomplished via mouse motion bindings on the + widget. When a sash is moved, the sizes of the panes on each side o +f the sash, and thus the widgets in thosepanes, are adjusted. When a pane is resized from outside (eg, it is packed to expand and fi +ll, and the containing toplevel is resized), space is added to the fi +nal (rightmost or bottommost) pane in the window.
An example:
#!/usr/bin/perl -w use strict; use Tk; my @scrollregion = (0,0,500,500); my $mw=tkinit; my $windowpane = $mw->Panedwindow( -orient => 'vertical' ) ->pack( -side => 'top' , -expand => 1, -fill => 'both' ); my $firstframe=$mw->Frame(); my $secondframe=$mw->Frame(); my $cf=$firstframe->Scrolled( 'Canvas', -bg=>'red', -scrollregion=>\@scrollregion, -confine=>1, -scrollbars=>'se') ->pack(-expand=>1, -fill=>'both', -anchor=>'nw'); $cf->create('rectangle',0,0,500,500); my $statusbar = $firstframe->Label( -text=>"This is a statusbar") ->pack(-fill=>'x', -expand=>0); my $tw = $secondframe->Scrolled( 'Text', -scrollbars=>'osoe') ->pack(-fill=>'both', -expand=>1, -anchor=>'nw'); $windowpane->add($firstframe, -sticky=>'nsew'); $windowpane->add($secondframe, -sticky=>'nsew'); $windowpane->bind( '<Configure>' => \&OnResize ); $mw->bind( '<Configure>' => \&OnResize ); MainLoop; sub OnResize{ my ($newx,$newy) = ($mw->width, $mw->height); $cf->configure( -scrollregion=>[0,0,$newx,$newy]); } #########################################################

I'm not really a human, but I play one on earth.
Old Perl Programmer Haiku ................... flash japh

Replies are listed 'Best First'.
Re^2: perl tk graphviz
by dlal66 (Acolyte) on Feb 23, 2012 at 20:28 UTC
    Thank you. I tried using the <Leave> and <Enter> bindings but it did not really help in the sense that the resize did not always happen for some reason. BUT I was able to resolve the issue by using CanvasBind instead of Bind. I therefore now have something like:
    $gv->CanvasBind('<Configure>',...)
    and that does the job perfectly (no flickering, etc.)