For Programmers: Free Programming Magazines  


Home > Archive > PerlTk > February 2008 > Recalcitrant borders and buttons









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Recalcitrant borders and buttons
fr2lax@gmail.com

2008-02-04, 10:23 pm

A while back, 'Janice' noted that perl tk for win32 seemed to ignore
certain requests for a change in borderwidth. I have noticed that
canvas ignores requests for zero width borders. Is anyone aware of a
fix?

Has anyone had trouble heigth sizing buttons? For example, if you
request a 1m high button in the win32 situation, the request is
ignored. If you request a 1m high canvas, the request is respected.
Short of designing a canvas to act as a button, is anyone aware of a
workaround?

Any help would be appreciated. Thanx.
Fred
Jack D

2008-02-05, 4:23 am


<fr2lax@gmail.com> wrote in message
news:bbc44c24-3230-4638-8069-85d742e86aca@i72g2000hsd.googlegroups.com...
>A while back, 'Janice' noted that perl tk for win32 seemed to ignore
> certain requests for a change in borderwidth. I have noticed that
> canvas ignores requests for zero width borders. Is anyone aware of a
> fix?
>
> Has anyone had trouble heigth sizing buttons? For example, if you
> request a 1m high button in the win32 situation, the request is
> ignored. If you request a 1m high canvas, the request is respected.
> Short of designing a canvas to act as a button, is anyone aware of a
> workaround?
>
> Any help would be appreciated. Thanx.
> Fred


I posted a workaround for your second problem a number of years ago. Here is
the link:

http://groups.google.com/group/comp...943494b69b0a9da

For the first problem (borderwidth of the canvas) perhaps you are confusing
the focus rectangle (i.e. highlightthickness) option with the borderwidth.
The program below works fine for me on Win32:

#!/usr/bin/perl

use Tk;
use strict;
my $bd=1;
my $ht=1;
#weird colors so you can see the boundaries
my $mw=tkinit(-bg=>'blue');
my $c = $mw->Canvas(
-bg=>'red',
-relief=>'raised',
-bd=>$bd,
-highlightthickness=>$ht);
$c->pack;

my $s1 = $mw->Scale(
-label=>'borderwidth',
-variable=>\$bd,
-from=>0,-to=>30,
-orient=>'horizontal',
-command=>\&redoCanvas)->pack;
my $s2 = $mw->Scale(
-label=>'highlightthickness',
-variable=>\$ht,
-from=>0,-to=>30,
-orient=>'horizontal',
-command=>\&redoCanvas)->pack;

MainLoop;
sub redoCanvas
{
$c->configure (-bd=>$bd, -highlightthickness=>$ht);
}
__END__

Jack D


ac

2008-02-05, 7:11 pm

Dang it, Jack, stop being so helpful! ;-)
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com