Home > Archive > PerlTk > October 2004 > Any way to change the text of a compound image?
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 |
Any way to change the text of a compound image?
|
|
| Ala Qumsieh 2004-10-07, 8:56 pm |
| Hi all,
I have a compound image with text underneath. Is it possible to change
the text after the Tk::Compound object has been created?
I can't seem to be able to access anything inside my compound object via
children/Subwidgets/etc, and the return value of the $compound->Text()
call is an empty string.
--Ala
| |
| zentara 2004-10-09, 3:55 pm |
| On Fri, 08 Oct 2004 00:44:37 GMT, Ala Qumsieh <notvalid@email.com>
wrote:
>Hi all,
>
>I have a compound image with text underneath. Is it possible to change
>the text after the Tk::Compound object has been created?
>
>I can't seem to be able to access anything inside my compound object via
>children/Subwidgets/etc, and the return value of the $compound->Text()
>call is an empty string.
Yeah, I couldn't get it to change anyways except by rebuilding it.
The perldoc Tk::Compound says:
When a compound image is created, Tk also creates a new
object. This object supports the configure and cget meth-
ods described in Tk::options which can be used to enquire
and modify the options described above.
(image and text not above)
The object also supports the following methods:
....
....
Where image and text are.......
#!/usr/bin/perl
use warnings;
use strict;
use Tk;
use Tk::JPEG;
use Tk::Compound;
my $mw=tkinit;
my $image = $mw->Photo(-file => 'zenbw_r.jpg');
my $c = $mw->Compound();
my $image1 = $c->Image(-image => $image);
my $text1 = $c->Text(-text => 'Yee', -font => "Arial 24");
my $button = $mw->Button(-image => $c ,
-command => [\&update],
)->pack;
MainLoop;
sub update{
undef $c;
$c = $mw->Compound();
my $image1 = $c->Image(-image => $image);
my $text1 = $c->Text(-text => 'Hah', -font => "Arial 24");
$button->configure (-image => $c );
}
__END__
--
I'm not really a human, but I play one on earth.
http://zentara.net/japh.html
| |
| Slaven Rezic 2004-10-19, 8:56 pm |
| Ala Qumsieh <notvalid@email.com> writes:
> Hi all,
>
> I have a compound image with text underneath. Is it possible to change
> the text after the Tk::Compound object has been created?
>
> I can't seem to be able to access anything inside my compound object
> via children/Subwidgets/etc, and the return value of the
> $compound->Text() call is an empty string.
>
I suspect that creating a Tk::Compound object is similar to drawing on
a GD or Image::Magick image. It's bitmap based, not vector based like
Canvas, so it's not possible to change something afterwards.
Regards,
Slaven
--
Slaven Rezic - slaven <at> rezic <dot> de
sf-upload: make batch releases on SourceForge
http://sf-upload.sf.net
|
|
|
|
|