in reply to perl/TK - background image

You need to learn the difference between a window and a widget. Mainwindows do not have a background, you have to fill them with widgets that have the background capability, and according to your needs, the ability to place widgets on top. The only widget which easily does this is the canvas. As a matter of fact, I worked out a canvas based widget, with a background image at Tk::CanvasDirTree.

A simple example is below. But there are glitches. You may not be able to acheive background transparency on your inserted widgets. A workaround would be to build your own custom canvas widgets out of geometric shapes, and use mouse bindings on them, to simulate the widget actions.

#!/usr/bin/perl use warnings; use strict; use Tk; use Tk::JPEG; use Tk::PNG; my $file = shift || die "need a bmp, gif,jpg or png as arg 1\n"; my $mw=tkinit; my $canvas = $mw->Scrolled('Canvas')->pack(-expand=>1, -fill=>'both'); my $img = $mw->Photo( -file => $file ); $canvas->createImage(0,0, -image => $img, -anchor => 'nw', -tags => ['img'], ); bunchOfBoxes(); sometext(); MainLoop; sub bunchOfBoxes{ for(0..5){ my $window = $canvas->Checkbutton(-text=> $_); $canvas->createWindow(10, 10+ $_ * 20, -window=> $window); } } sub sometext{ $canvas->createText( 50 , 50, -text => 'foobar', -anchor => 'center', -fill => 'hotpink', ); }

I'm not really a human, but I play one on earth. Cogito ergo sum a bum