Code Comments
Programming Forum and web based access to our favorite programming groups.Hello All, Hi there, is it possible to create buttons that contain images (using Tk::JPEG), that will appear to be flush against each other with no borders in between? I basically have a large image that is divided into 5 smaller images, each of these images is on its own button, and I cannot seem to be able to make them appear seamless. I would like the finished 5 images to appear to be one large image. I have tried setting "borderwidth" to 0 on the buttons, I have set the "relief" to 'flat' and still I have lines in between the buttons. Is there any way to do this? Thanks, Langdon Algar
Post Follow-up to this messageIn article <1105584608.677661.133310@c13g2000cwb.googlegroups.com>,
evilcommandcenter@yahoo.com says...
> Hi there, is it possible to create buttons that contain images
> (using Tk::JPEG), that will appear to be flush against each other
> with no borders in between? I basically have a large image that
> is divided into 5 smaller images, each of these images is on its
> own button, and I cannot seem to be able to make them appear
> seamless. I would like the finished 5 images to appear to be one
> large image.
>
> I have tried setting "borderwidth" to 0 on the buttons, I have
> set the "relief" to 'flat' and still I have lines in between the
> buttons. Is there any way to do this?
-highlightthickness => 0
use strict;
use Tk;
my $mw = tkinit;
my %image;
map {$image{$_} = $mw->Photo(-file => "Z:/img-$_.bmp")} qw/nw ne sw se/;
my %options = (-bd => 0, -highlightthickness => 0);
$mw->Button(-image => $image{nw}, %options)->grid(-row => 0, -column => 0);
$mw->Button(-image => $image{ne}, %options)->grid(-row => 0, -column => 1);
$mw->Button(-image => $image{sw}, %options)->grid(-row => 1, -column => 0);
$mw->Button(-image => $image{se}, %options)->grid(-row => 1, -column => 1);
MainLoop;
--
Go to http://MarcDashevsky.com to send me e-mail.
Post Follow-up to this messageMarc, Thanks for your help, unfortunately this doesn't seem to be working on my system.Setting the highlight thickness to zero did make the button borders thinner, but there was still a visible line between the buttons. I thought the problem might have been with the fact that the buttons were using jpeg images, or that they were different sizes, so I tried running your exact code using the same square .bmp for each button and using "grid" instead of "pack"... but there are still visible borders. Not sure what the problem could be. -Langdon
Post Follow-up to this messageOn 15 Jan 2005 23:43:22 -0800, "Langdon Algar" <evilcommandcenter@yahoo.com> wrote: >Marc, > >Thanks for your help, unfortunately this doesn't seem to be >working on my system.Setting the highlight thickness to zero did >make the button borders thinner, but there was still a visible >line between the buttons. I thought the problem might have been >with the fact that the buttons were using jpeg images, or that >they were different sizes, so I tried running your exact code >using the same square .bmp for each button and using "grid" >instead of "pack"... but there are still visible borders. Not >sure what the problem could be. >-Langdon Yeah, I have found the same thing. I tried the -padx and -ipadx settings to no avail. I have found 2 "workarounds. 1. Specify a black background and black activebackground in the buttons, which make it appear seamless. 2. Put your photo's on a canvas in rectangles, and set the rectangle width to 0. That will make them seamless. (But you lose the button action unless you make it yourself manually.) -- I'm not really a human, but I play one on earth. http://zentara.net/japh.html
Post Follow-up to this messageIn article <1105861402.119226.214030@f14g2000cwb.googlegroups.com>, evilcommandcenter@yahoo.com says... > Marc, > > Thanks for your help, unfortunately this doesn't seem to be > working on my system.Setting the highlight thickness to zero did > make the button borders thinner, but there was still a visible > line between the buttons. I thought the problem might have been > with the fact that the buttons were using jpeg images, or that > they were different sizes, so I tried running your exact code > using the same square .bmp for each button and using "grid" > instead of "pack"... but there are still visible borders. Not > sure what the problem could be. Isn't that odd. I'm running Windows on a 1600x1200 display and the images are seamless. -- Go to http://MarcDashevsky.com to send me e-mail.
Post Follow-up to this messagewon't -relief => 'flat' do what you are looking for? "Langdon Algar" <evilcommandcenter@yahoo.com> wrote in message news:1105861402.119226.214030@f14g2000cwb.googlegroups.com... > Marc, > > Thanks for your help, unfortunately this doesn't seem to be > working on my system.Setting the highlight thickness to zero did > make the button borders thinner, but there was still a visible > line between the buttons. I thought the problem might have been > with the fact that the buttons were using jpeg images, or that > they were different sizes, so I tried running your exact code > using the same square .bmp for each button and using "grid" > instead of "pack"... but there are still visible borders. Not > sure what the problem could be. > -Langdon >
Post Follow-up to this messageLangdon Algar wrote: > Hello All, > > Hi there, is it possible to create buttons that contain images > (using Tk::JPEG), that will appear to be flush against each other > with no borders in between? I basically have a large image that > is divided into 5 smaller images, each of these images is on its > own button, and I cannot seem to be able to make them appear > seamless. I would like the finished 5 images to appear to be one > large image. > Do you see the same behavior when using the Label widget? I've seen this in the past on Windows, and in a few occasions opted for my own "Button" using Label and a few judicious bindings. It allowed me to achieve a bit more consistency between platforms. Rob
Post Follow-up to this messagePowered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.