For Programmers: Free Programming Magazines  


Home > Archive > PerlTk > June 2004 > Button: asymmetrical padx









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 Button: asymmetrical padx
gerhard.petrowitsch@philips.com

2004-06-03, 7:10 pm

Hi all,

if I'm using the '-padx' switch for a Tk::Button, I only can stretch
the button by an even amount of pixels (as Tk always pads the
button on both sides of the text by the same amount).

Is there a way to have the button stretched by different amounts
left and right of the text or at least by an odd amount of pixels?

Or do I have to write my own button widget?

Thanks & regards,
Gerhard


-++**==--++**==--++**==--++**==--++**==--++**==--++**==
This message was posted through the Stanford campus mailing list
server. If you wish to unsubscribe from this mailing list, send the
message body of "unsubscribe ptk" to majordomo@lists.stanford.edu
$_@_.%_

2004-06-03, 7:10 pm


gerhard.petrowitsch@philips.com wrote in message-id:
<c8urq8$gfi$1@fidoii.CC.Lehigh.EDU>
>
>Hi all,
>
>if I'm using the '-padx' switch for a Tk::Button, I only can stretch
>the button by an even amount of pixels (as Tk always pads the
>button on both sides of the text by the same amount).
>
>Is there a way to have the button stretched by different amounts
>left and right of the text or at least by an odd amount of pixels?
>
>Or do I have to write my own button widget?
>
>Thanks & regards,
>Gerhard
>
>
>-++**==--++**==--++**==--++**==--++**==--++**==--++**==
>This message was posted through the Stanford campus mailing list
>server. If you wish to unsubscribe from this mailing list, send the
>message body of "unsubscribe ptk" to majordomo@lists.stanford.edu


for that really 'custom look' you might consider using images.


Ala Qumsieh

2004-06-03, 7:10 pm


--- gerhard.petrowitsch@philips.com wrote:
> Hi all,
>
> if I'm using the '-padx' switch for a Tk::Button, I
> only can stretch
> the button by an even amount of pixels (as Tk always
> pads the
> button on both sides of the text by the same
> amount).
>
> Is there a way to have the button stretched by
> different amounts
> left and right of the text or at least by an odd
> amount of pixels?
>
> Or do I have to write my own button widget?


Can't you simple do something like:

-text => ' Text'
or
-text => 'Text '

?

--Ala





__________________________________
Do you Yahoo!?
Friends. Fun. Try the all-new Yahoo! Messenger.
http://messenger.yahoo.com/
-++**==--++**==--++**==--++**==--++**==--++**==--++**==
This message was posted through the Stanford campus mailing list
server. If you wish to unsubscribe from this mailing list, send the
message body of "unsubscribe ptk" to majordomo@lists.stanford.edu
gerhard.petrowitsch@philips.com

2004-06-03, 7:10 pm

Hi Ala,

unfortunately I can't just pad the text with spaces.
I need pixel-accurate padding with arbitrary texts of unknown
contents. I mean unknown at compile time. It is read from a
configuration file.

Any other idea?

Regards,
---------------------------------------------------------------------------------------
Gerhard Petrowitsch Tel.: +49 8151 270 126
Philips Semiconductors Fax: +49 8151 270 200
Petersbrunnerstr. 17 Home Office: +49 821 9069 741
82319 Starnberg, Germany SERI: gerhard@DESTNSC1
---------------------------------------------------------------------------------------
Be like the ant. When the ant gets a mixture of sand and sugar,
it selects only sugar; it neglects sand. See only good in others.
Pay no attention to the bad. (Sathya Sai Baba)
--------------------------------------------------------------------------------------------




To: Gerhard Petrowitsch/STN/SC/PHILIPS@EMEA1
ptk@lists.Stanford.EDU
cc:
Subject: Re: Button: asymmetrical padx
Ala Qumsieh
<ala_qumsieh@yahoo.com> Classification:

Sent by:
owner-ptk@lists.Stanford
.EDU

2004-05-25 04:49 PM







--- gerhard.petrowitsch@philips.com wrote:
> Hi all,
>
> if I'm using the '-padx' switch for a Tk::Button, I
> only can stretch
> the button by an even amount of pixels (as Tk always
> pads the
> button on both sides of the text by the same
> amount).
>
> Is there a way to have the button stretched by
> different amounts
> left and right of the text or at least by an odd
> amount of pixels?
>
> Or do I have to write my own button widget?


Can't you simple do something like:

-text => ' Text'
or
-text => 'Text '

?

--Ala





__________________________________
Do you Yahoo!?
Friends. Fun. Try the all-new Yahoo! Messenger.
http://messenger.yahoo.com/
-++**==--++**==--++**==--++**==--++**==--++**==--++**==
This message was posted through the Stanford campus mailing list
server. If you wish to unsubscribe from this mailing list, send the
message body of "unsubscribe ptk" to majordomo@lists.stanford.edu





-++**==--++**==--++**==--++**==--++**==--++**==--++**==
This message was posted through the Stanford campus mailing list
server. If you wish to unsubscribe from this mailing list, send the
message body of "unsubscribe ptk" to majordomo@lists.stanford.edu
Dean Arnold

2004-06-03, 7:10 pm

gerhard.petrowitsch@philips.com wrote:

> Hi Ala,
>
> unfortunately I can't just pad the text with spaces.
> I need pixel-accurate padding with arbitrary texts of unknown
> contents. I mean unknown at compile time. It is read from a
> configuration file.
>
> Any other idea?
>
> Regards,
> ---------------------------------------------------------------------------------------
> Gerhard Petrowitsch Tel.: +49 8151 270 126
> Philips Semiconductors Fax: +49 8151 270 200
> Petersbrunnerstr. 17 Home Office: +49 821 9069 741
> 82319 Starnberg, Germany SERI: gerhard@DESTNSC1


Do you know the font size at startup/layout time ?
If so, you could compute the size of the button text
in pixels, then compute how many add'l spaces to add
to either end. In fact, if you're computing padx/pady,
do you already do that computation ?

Dean Arnold
Presicient Corp.
www.presicient.com

-++**==--++**==--++**==--++**==--++**==--++**==--++**==
This message was posted through the Stanford campus mailing list
server. If you wish to unsubscribe from this mailing list, send the
message body of "unsubscribe ptk" to majordomo@lists.stanford.edu
gerhard.petrowitsch@philips.com

2004-06-03, 7:10 pm

Hi Dean,

I'm not computing the text size. I am just using the 'width' method
to find out the width of a number of buttons. Now as some come
out with odd, some with even widths. This would be the same, if
I would compute the text size.

Now if I want to make them all the same width (without messing around
with their text), I just need a means to add a different number of pixels to
the right and to the left of their texts. In fact, the difference will be 1 in my
case.
I cannot just use the grid manager with 'sticky => "ew"'
attribute for reasons that would take longer to explain.

Regards,
Gerhard







To: Gerhard Petrowitsch/STN/SC/PHILIPS@EMEA1
cc: ptk@lists.Stanford.EDU
Subject: Re: Button: asymmetrical padx

Dean Arnold Classification:
<darnold@presicient.com>

Sent by:
owner-ptk@lists.Stanford
.EDU

2004-05-25 06:29 PM






gerhard.petrowitsch@philips.com wrote:

> Hi Ala,
>
> unfortunately I can't just pad the text with spaces.
> I need pixel-accurate padding with arbitrary texts of unknown
> contents. I mean unknown at compile time. It is read from a
> configuration file.
>
> Any other idea?
>
> Regards,
> Gerhard


Do you know the font size at startup/layout time ?
If so, you could compute the size of the button text
in pixels, then compute how many add'l spaces to add
to either end. In fact, if you're computing padx/pady,
do you already do that computation ?

Dean Arnold
Presicient Corp.
www.presicient.com

-++**==--++**==--++**==--++**==--++**==--++**==--++**==
This message was posted through the Stanford campus mailing list
server. If you wish to unsubscribe from this mailing list, send the
message body of "unsubscribe ptk" to majordomo@lists.stanford.edu





-++**==--++**==--++**==--++**==--++**==--++**==--++**==
This message was posted through the Stanford campus mailing list
server. If you wish to unsubscribe from this mailing list, send the
message body of "unsubscribe ptk" to majordomo@lists.stanford.edu
Michele Dondi

2004-06-03, 7:10 pm

On Tue, 25 May 2004 07:49:12 -0700 (PDT), Ala Qumsieh
<ala_qumsieh@yahoo.com> wrote:

>Can't you simple do something like:
>
> -text => ' Text'
>or
> -text => 'Text '
>
>?


Ouch! Doesn't this look so much like M$ Word's (average users')
advanced formatting techniques by means of repeated blank spaces or
newlines? ;-)


Michele
--
$\=q.,.,$_=q.print' ,\g,,( w,a'c'e'h,,map{$_-=qif/g/;chr
}107..q[..117,q)[map+hex,split//,join' ,2B,, w$ECDF078D3'
F9'5F3014$,$,];];$\.=$/,s,q,32,g,s,g,112,g,y,' , q,,eval;
Ala Qumsieh

2004-06-03, 7:10 pm

Michele Dondi wrote:
> On Tue, 25 May 2004 07:49:12 -0700 (PDT), Ala Qumsieh
> <ala_qumsieh@yahoo.com> wrote:
>
>
>
>
> Ouch! Doesn't this look so much like M$ Word's (average users')
> advanced formatting techniques by means of repeated blank spaces or
> newlines? ;-)


Hey, I use that all the time ;)
It reminds me more of Python *shudder*

--Ala
Ala Qumsieh

2004-06-03, 7:10 pm

Michele Dondi wrote:

> On Tue, 25 May 2004 07:49:12 -0700 (PDT), Ala Qumsieh
> <ala_qumsieh@yahoo.com> wrote:
>
>
>
>
> Ouch! Doesn't this look so much like M$ Word's (average users')
> advanced formatting techniques by means of repeated blank spaces or
> newlines? ;-)


Hey, I use that all the time ;)
It reminds me more of Python *shudder*

--Ala

Michele Dondi

2004-06-03, 7:10 pm

On Tue, 01 Jun 2004 18:30:54 GMT, Ala Qumsieh <notvalid@email.com>
wrote:

>
>Hey, I use that all the time ;)
>It reminds me more of Python *shudder*


Oh poor you! For using the redmondish wp, that is... I *had* to use it
too in an office I've been working: not at all one of my best
experiences!


Michele
--
$\=q.,.,$_=q.print' ,\g,,( w,a'c'e'h,,map{$_-=qif/g/;chr
}107..q[..117,q)[map+hex,split//,join' ,2B,, w$ECDF078D3'
F9'5F3014$,$,];];$\.=$/,s,q,32,g,s,g,112,g,y,' , q,,eval;
Sponsored Links







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

Copyright 2008 codecomments.com