Hello Perlmonks

I'm in the process of converting a Perl/Tk app to a Tkx version.
This turns out to be a bit harder than I hoped.
Some of you monks already solved a few problems,
but I ran into new ones.

The code had a tree, but I was noticed that tree has a bug. Turned to listbox instead.
The code attached shows a frame with a button and a listbox. However:
1- removed, tree bug
2- I want to see the list-item (the text-part) when I click on it, not the index
3- And I want to set the background color of the button and the frame (independently)
Can anyone help me? Thank you!
#!/usr/bin/perl -- use strict; use warnings; use Tkx; $Tkx::TRACE = 64; Tkx::package_require('tile'); use Tkx; my $mw = Tkx::widget->new("."); my $f_report_period = $mw->new_ttk__labelframe( -text => "report period", -labelanchor => 'nw', -relief => 'groove', -borderwidth => '5' ); my $listview = $f_report_period->new_tk__listbox( -height => 5, ); $listview->insert( "end", "T $_ and a very long text to come after that" ) for 1 .. 20; my $tree_sbv = $f_report_period->new_ttk__scrollbar( -command => [ $listview, "yview" ], -orient => "vertical" ); my $tree_sbh = $f_report_period->new_ttk__scrollbar( -command => [ $listview, "xview" ], -orient => "horizontal" ); $listview->configure( -yscrollcommand => [ $tree_sbv, "set" ] ); $listview->configure( -xscrollcommand => [ $tree_sbh, "set" ] ); $listview->g_bind("<1>" , sub{&showline}); sub showline { my @item = $listview->curselection; if ($#item==0) { print "$item[0] \n"; } } $f_report_period->g_grid( -row => 1, -column => 0, -rowspan => 2, -sticky => 'nsew' ); $b_change_year->g_grid( -row => 0, -column => 0, -columnspan => 2, -sticky => 'nsew', ); $listview->g_grid( -row => 1, -column => 0, -rowspan => 1, -sticky => 'nsew' ); $tree_sbv->g_grid( -row => 1, -column => 1, -sticky => 'ns' ); $tree_sbh->g_grid( -row => 2, -column => 0, -sticky => 'we' ); Tkx::MainLoop();

In reply to several tkx questions by momo33

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.