in reply to Text widget on Photo (Tk)
#!/usr/bin/perl use warnings; use strict; use Tk; use Tk::JPEG; use Image::Magick; my $im = Image::Magick->new; my $image = shift || '2uni2.jpg'; my ($width, $height, $size, $format) = $im->Ping($image); my $mw = MainWindow->new(); my $canv = $mw->Canvas(-bg => 'lightsteelblue', -relief => 'sunken', -width => $width, -height => $height)->pack(-expand => 1, -fill => 'both'); my $img = $mw->Photo(-file => $image ); $canv->createImage( 0, 0, -image => $img, -anchor => 'nw' ); my $text = $mw->Scrolled('Text', -bg=>'white', -scrollbars=>'osoe', ); my $textcontainer = $canv->createWindow( $width/2, $height/2, # default anchor is center -window => $text, -width => $width -200, -height => $height-200, -state => 'normal'); $text->focus; MainLoop();
|
|---|