I am using Perl and Tk to display a window with images inside. It cycles through images in the pattern of white background, black background, image (1280x800), repeat. The problem is that I need to be able to view the entire image. Tk is putting on a 2-pixel border on top of the images, including the black and white backgrounds. Here is my code...
use Tk;
# Create and configure the canvas:
my $canvas = $mw->Canvas( -cursor=>"crosshair", -background=>"black",
-width=>1280, -height=>800 )->pack();
my $canvasWidth = 1280;
my $canvasHeight = 800;
my $blackRect = $canvas->createRectangle(0,0,$canvasWidth,$canvasHeight, -fill => "black", -tags => ['blackRect']);
my $whiteRect = $canvas->createRectangle(0,0,$canvasWidth,$canvasHeight, -fill => "white", -tags => ['whiteRect']);
# create a Photo object and one Button then we will reuse it.
my $shot = $canvas->Photo();
my $image = $canvas->createImage(0,0, -image => $shot, -anchor => "nw", -tags => ['image']);
# Remove the borders
$mw->overrideredirect(1);
# Loop through images
I know that overrideredirect
gets rid of most of the extra stuff, but it still doesn't give me a naked window. I have tried adding -borderwidth=>0
to the Canvas creation, and it changes nothing.
The border appears immediately and never goes away, not just when the first image is displayed.
Can this border be removed? If so, how?
Add
-highlightthickness => 0
to the Canvas
call. This will remove the border which is used to show the currently focussed widget.