[wxPython] wxListCtrl hides first row?

I have been experimenting with ListCtrl based on the demo.
I have a few questions, but I have to do some more experimenting
first then maybe I will ask here.
But, this is strange behaviour. I searched the archives but I did not
find a reference to the following problem.

Please look at the following code (from the wxPyWiki example):

···

-----------------------------------------------------
from wxPython.wx import *

class MainFrame(wxFrame):
    def __init__(self, parent, id, title):
        wxFrame.__init__(self, parent, id, title, wxDefaultPosition,
          
                                      wxSize(1000,680))

        id=wxNewId()
        title = "This is an example of a ListCtrl"

        # See what happens when you uncomment the next line... !!!!
        #text = wxStaticText(self, -1, title, wxPoint(430, 30))

        self.list=wxListCtrl(self,id,wxPoint(20, 130), wxSize(950, 420),
                      style=wxLC_REPORT|wxSUNKEN_BORDER|wxLC_VRULES)
        self.list.Show(true)

        self.list.InsertColumn(0,"Data #1")
        self.list.InsertColumn(1,"Data #2")
        self.list.InsertColumn(2,"Data #3")

        self.list.InsertStringItem(0,"First")
        self.list.SetStringItem(0,1,"row")
        self.list.SetStringItem(0,2,"!")

        self.list.InsertStringItem(1,"Second")
        self.list.SetStringItem(1,1,"row")
        self.list.SetStringItem(1,2,"!!")

        self.list.InsertStringItem(2,"Third")
        self.list.SetStringItem(2,1,"row")
        self.list.SetStringItem(2,2,"!!!")

class MyApp(wxApp):
    def OnInit(self):
        frame = MainFrame(NULL, 1, "wxListCtrl Example")
        self.SetTopWindow(frame)
        frame.Show(true)
        return true

app = MyApp(0)
app.MainLoop()
------------------------------------------

If I uncomment the wxStaticText, the first row is no
longer shown!

I am working with RedHat 7.1, wxPython-2.3.2.1, wxGTK-2.3.2-1

I this known behaviour? or a bug?
Thanks for your guidance.

Cesar Morelos

CESAR ALEJANDRO MORELOS ZARAGOZA PAZZI wrote:

I have been experimenting with ListCtrl based on the demo.
I have a few questions, but I have to do some more experimenting
first then maybe I will ask here.
But, this is strange behaviour. I searched the archives but I did not
find a reference to the following problem.

Hello.
to solve it, you must set the size of the wxListCtrl after creation

The new example:

from wxPython.wx import *

class MainFrame(wxFrame):
    def __init__(self, parent, id, title):
        wxFrame.__init__(self, parent, id, title, wxDefaultPosition,
                                               wxSize(1000,680))

        id=wxNewId()
        title = "This is an example of a ListCtrl"

        # See what happens when you uncomment the next line... !!!!
        text = wxStaticText(self, -1, title, wxPoint(430, 30))

        self.list=wxListCtrl(self,id,wxPoint(20, 130), wxSize(950, 420),
                      style=wxLC_REPORT|wxSUNKEN_BORDER|wxLC_VRULES)
        self.list.SetSize(self.list.GetSize()) # to solve minor bug under wxGtk...
        self.list.Show(true)
               self.list.InsertColumn(0,"Data #1")
        self.list.InsertColumn(1,"Data #2")
        self.list.InsertColumn(2,"Data #3")

        self.list.InsertStringItem(0,"First")
        self.list.SetStringItem(0,1,"row")
        self.list.SetStringItem(0,2,"!")

        self.list.InsertStringItem(1,"Second")
        self.list.SetStringItem(1,1,"row")
        self.list.SetStringItem(1,2,"!!")

        self.list.InsertStringItem(2,"Third")
        self.list.SetStringItem(2,1,"row")
        self.list.SetStringItem(2,2,"!!!")

class MyApp(wxApp):
    def OnInit(self):
        frame = MainFrame(NULL, 1, "wxListCtrl Example")
        self.SetTopWindow(frame)
        frame.Show(true)
        return true

app = MyApp(0)
app.MainLoop()

I Think it is an old bug in wxPython code...

CESAR ALEJANDRO MORELOS ZARAGOZA PAZZI wrote:

I have been experimenting with ListCtrl based on the demo.
I have a few questions, but I have to do some more experimenting
first then maybe I will ask here.
But, this is strange behaviour. I searched the archives but I did not
find a reference to the following problem.

Hello.
to solve it, you must set the size of the wxListCtrl after creation

The new example:

from wxPython.wx import *

class MainFrame(wxFrame):
   def __init__(self, parent, id, title):
       wxFrame.__init__(self, parent, id, title, wxDefaultPosition, wxSize(1000,680))

       id=wxNewId()
       title = "This is an example of a ListCtrl"

       # See what happens when you uncomment the next line... !!!!
       text = wxStaticText(self, -1, title, wxPoint(430, 30))

       self.list=wxListCtrl(self,id,wxPoint(20, 130), wxSize(950, 420),
                     style=wxLC_REPORT|wxSUNKEN_BORDER|wxLC_VRULES)
       self.list.SetSize(self.list.GetSize()) # to solve minor bug under wxGtk...
       self.list.Show(true)
             self.list.InsertColumn(0,"Data #1")
       self.list.InsertColumn(1,"Data #2")
       self.list.InsertColumn(2,"Data #3")

       self.list.InsertStringItem(0,"First")
       self.list.SetStringItem(0,1,"row")
       self.list.SetStringItem(0,2,"!")

       self.list.InsertStringItem(1,"Second")
       self.list.SetStringItem(1,1,"row")
       self.list.SetStringItem(1,2,"!!")

       self.list.InsertStringItem(2,"Third")
       self.list.SetStringItem(2,1,"row")
       self.list.SetStringItem(2,2,"!!!")

class MyApp(wxApp):
   def OnInit(self):
       frame = MainFrame(NULL, 1, "wxListCtrl Example")
       self.SetTopWindow(frame)
       frame.Show(true)
       return true

app = MyApp(0)
app.MainLoop()

I Think it is an old bug in wxPython code...

Julio Jiménez ... I forget to put my name... :slight_smile: