CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate:
Perl Tkx Canvas - insert Text Item

 



john15276
New User

Jul 24, 2013, 1:05 AM

Post #1 of 1 (767 views)
Perl Tkx Canvas - insert Text Item Can't Post

Hi,
I am learning Perl Tkx canvas and having problem adding text
to the item created in the canvas window. In my program I expect to see the text "testing" to go along with the rectangular box but it does not work. If you see what I am missing please point it out. Thanks so much in advance.
-----------------------------------
use Tkx;
$mw = Tkx::widget->new(".");
$canvas = $mw->new_tk__canvas;
$canvas->g_grid(-column=>0, -row=>0, -sticky=>"nwes");
$mw->g_grid_columnconfigure(0, -weight=>1);
$mw->g_grid_rowconfigure(0, -weight=>1);

$id = $canvas->create_rectangle(30, 30, 200, 80, -fill => "red", -tags => "first_box");
$canvas->insert($id, 0, "testing"); #<== testing not displayed

$canvas->g_bind("<1>", [sub {$canvas->itemconfigure("current",-fill => "green");}]);

Tkx::MainLoop();

Code
[reply][/reply][reply] 

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives