use Tkx; my $mw = Tkx::widget->new("."); #std line $frm_main= $mw->new_frame(); #parent widg probably a frame outside of this compound control $frm_main->g_pack( -expand => 0, -fill => 'x', -side => top); my $tree=$frm_main->new_ttk__treeview; #http://www.tkdocs.com/tutorial/tree.html $tree->g_pack( -expand => 0, -fill => 'x', -side => top); $gLast_id="root"; $gLast_id=$tree->insert("", "end", -id => $gLast_id, -text => "root"); $tree->item($gLast_id, -open => "true"); #$tree->focus($gLast_id); $tree->g_bind( "", sub { $gLast_id=$tree->insert($gLast_id, "end", -text => "some_text" ); $tree->item($gLast_id, -open => "true"); #http://www.tkdocs.com/tutorial/tree.html #$tree->focus($gLast_id); }); Tkx::MainLoop();