Home > Archive > PerlTk > February 2008 > Regarding an issue in ROText
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 |
Regarding an issue in ROText
|
|
| Nishant 2008-02-14, 8:07 am |
| Hi All,
I'm using ROtext widget in my application. Now, it accepts width in
the charatcter.
At one time, I try to get width of the ROtext, but it gives me the
width in pixels.
The code is ->
my $ruleDesc = $results_help_frame->Scrolled("ROText",-scrollbars =>
"osoe",
-width => 15 )
->pack(-fill => "both", -
expand => 1,-side=>'bottom',-pady =>2);
$ruleDesc->bind('<Configure>' => sub {
my $width = $ruleDesc->width();
print "width is -> $width ";
});
Now, the print statement in the configure binding gives me the width
in pixels.
Is there any way to get the width in characters or is there any way to
convert this width that I get in pixels back to character ?
Regards
Nishant Sharma
| |
| Raman 2008-02-14, 10:07 pm |
| On Feb 14, 6:36 pm, Nishant <nishant....@gmail.com> wrote:
>
> $ruleDesc->bind('<Configure>' => sub {
> my $width = $ruleDesc->width();
use cget instead of width
my $width=$ruleDesc->cget(-width);
> print "width is -> $width ";
> });
Raman.P
| |
| Marc Dashevsky 2008-02-14, 10:07 pm |
| In article <2bd7704a-4dc2-4e8b-87de-ddf7020306f5@28g2000hsw.googlegroups.com>,
raamanp@gmail.com says...[color=darkred]
> On Feb 14, 6:36 pm, Nishant <nishant....@gmail.com> wrote:
>
> use cget instead of width
> my $width=$ruleDesc->cget(-width);
>
This is correct only in a very limited way. cget(-width) returns the
value of -width at the time of the widget's creation or of the most
recent configure(-width). Changes in the display size of the widget
due to the results of a geometry manager or the user expanding or
shrinking a window are not reflected in this value.
--
Go to http://MarcDashevsky.com to send me e-mail.
|
|
|
|
|