Thread Fehler bei Canvas resize binding + Panedwindow (2 answers)
Opened by pktm at 2011-03-07 21:38

MatthiasW
 2011-03-07 22:02
#146291 #146291
User since
2008-01-27
367 Artikel
BenutzerIn
[default_avatar]
Beim Setzen der -scrollregion werden keine Werte angegeben, solange nichts im Canvas gezeichnet ist [1]. Das kann man abfangen:
Code (perl): (dl )
1
2
3
4
5
6
# -- canvas resize binding
$canvas->Tk::bind('<Configure>' => sub{
        my @bbox = $canvas->bbox("all");
        @bbox = (0, 0, 0, 0) if @bbox != 4;
        $canvas->configure(-scrollregion => [ @bbox ]);
});

MfG

[1]
perldoc Tk::Canvas
[...]
$canvas->bbox(tagOrId, ?tagOrId, tagOrId, ...?)

[...]If no items match any of the tagOrId arguments or if the matching items have empty bounding boxes (i.e. they have nothing to display) then an empty string is returned.
perl -E'*==*",s;;%ENV=~m,..$,,$&+42;e,$==f;$"++for+ab..an;@"=qw,u t,,print+chr;sub f{split}say"@{=} me"'

View full thread Fehler bei Canvas resize binding + Panedwindow