Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??

Dear esteemed PerlMonks

I am trying to port a wxPython ListControl example, into wxPerl. The problem: I don't get the column heading titles (or bar).

Here are the details:
Original Python code example, taken from: http://stackoverflow.com/questions/5648816/ (first answer):

import wx class MainWindow(wx.Frame): def __init__(self, *args, **kwargs): wx.Frame.__init__(self, *args, **kwargs) self.panel = wx.Panel(self) self.panel.SetBackgroundColour(wx.GREEN) self.list = wx.ListCtrl(self, style=wx.LC_REPORT, size=(200, - +1)) column_size = self.list.GetSize()[0] / 2 - 2 self.list.InsertColumn(0, 'Name') self.list.InsertColumn(1, 'Age') self.list.SetColumnWidth(0, column_size) self.list.SetColumnWidth(1, column_size) self.sizer = wx.BoxSizer() self.sizer.Add(self.list, proportion=0, flag=wx.EXPAND) self.sizer.Add(self.panel, proportion=1, flag=wx.EXPAND) self.SetSizerAndFit(self.sizer) self.SetSize((600, 400)) self.Show() app = wx.App(False) win = MainWindow(None) app.MainLoop()

My port into wxPerl:

use strict; use warnings; use Wx; use 5.014; use autodie; use Carp; use Carp qw {cluck}; use Carp::Always; use Win32::Console; package MainWindow; use Wx ':everything'; use parent -norequire, 'Wx::Frame'; sub new { #1 MainWindow:: my $class = shift; my $self = $class->SUPER::new( undef, -1, # parent window; ID -1 means any 'Test', # title [-1,-1 ], # position [ -1, -1 ], # size ); # def __init__(self, *args, **kwargs): # wx.Frame.__init__(self, *args, **kwargs) $self->{panel} = Wx::Panel->new($self); $self->{panel}->SetBackgroundColour(wxGREEN); $self->{list} = Wx::ListCtrl->new($self->{panel}, wxLC_REPORT, + [200, -1]); my $column_size = $self->{list}->GetSize->width / 2 - 2; $self->{list}->InsertColumn(0, 'Name'); $self->{list}->InsertColumn(1, 'Age'); $self->{list}->SetColumnWidth(0, $column_size); $self->{list}->SetColumnWidth(1, $column_size); $self->{sizer} = Wx::BoxSizer->new(wxVERTICAL); $self->{sizer}->Add($self->{list}, 0, wxEXPAND); $self->{sizer}->Add($self->{panel}, 1, wxEXPAND); $self->SetSizerAndFit($self->{sizer}); $self->SetSize([600, 400]); return $self; } #1 end sub new MainWindow:: my $app = Wx::SimpleApp->new; my $win = MainWindow->new; $win->Show(1); $app->MainLoop;

The problem: you do get a window, which does get resized, but I don't see any ListCtrl heading line (or bar), or any column titles.
Am I doing something wrong? Is there a mistake somewhere?
My system: DWIM Perl 5.14.2 on Windows 7.

Your help will be appreciated.

Many TIA - Helen


In reply to Porting a wxPython List Control example into wxPerl: don't see column headings? by HelenCr

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!
  • 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, 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, 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.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others exploiting the Monastery: (16)
    As of 2015-07-28 21:27 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









      Results (259 votes), past polls