
john15276
New User
Jul 24, 2013, 1:05 AM
Post #1 of 1
(2460 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();
|