[wxPython] wxListCtrl second try

Sorry for my second try :frowning: wxPythonNewbie), but

is there a problem to put wxListCtrl on a Panel ( see Code C )

If I put direct in a Frame it works ( Code A )
If I put it on a Notebook in the Panel it works ( Code B)

I have done some experiments on Sizers without success.

Best regards
Manfred

路路路

##################################################
# t6.py

from wxPython.wx import *
from wxListCtrl import *

class myApp(wxPySimpleApp):

聽聽聽聽def run(self):
聽聽聽聽聽聽聽聽myFrame = wxFrame(None,-1, "Test ListCtrl")

聽聽聽聽聽聽聽聽"""
聽聽聽聽聽聽聽聽# Code A is ok
聽聽聽聽聽聽聽聽#noproblem = TestListCtrlPanel(myFrame,-1)

聽聽聽聽聽聽聽聽# Code B is ok
聽聽聽聽聽聽聽聽ppanel = wxPanel(myFrame,-1)
聽聽聽聽聽聽聽聽nb = wxNotebook(ppanel,-1,size=(400,200))
聽聽聽聽聽聽聽聽mylist = TestListCtrlPanel(nb,-1)
聽聽聽聽聽聽聽聽nb.AddPage(mylist, 'ListOnNotebook')
聽聽聽聽聽聽聽聽"""
聽聽聽聽聽聽聽聽############################################
聽聽聽聽聽聽聽聽# Code C - But this doesn't work
聽聽聽聽聽聽聽聽############################################
聽聽聽聽聽聽聽聽ppanel = wxPanel(myFrame,-1,size=(600,300))
聽聽聽聽聽聽聽聽problem = TestListCtrlPanel(ppanel,-1)

聽聽聽聽聽聽聽聽myFrame.Show(true)

if __name__ == "__main__":
聽聽聽聽app = myApp()
聽聽聽聽app.run()
聽聽聽聽app.MainLoop()

is there a problem to put wxListCtrl on a Panel ( see Code C )

If I put direct in a Frame it works ( Code A )
If I put it on a Notebook in the Panel it works ( Code B)

I have done some experiments on Sizers without success.

        ############################################
        # Code C - But this doesn't work
        ############################################
        ppanel = wxPanel(myFrame,-1,size=(600,300))
        problem = TestListCtrlPanel(ppanel,-1)

The notebook will automatically resize its immediate children to fill each
page, it is up to the child to resize and position its children however you
want. In your example you have a wxPanel (which should be a child of the
notebook by the way) and on it you have the TestListCtrlPanel. If you need
that extra panel there then you need to arrainge for it to resize the
listctrlpanel, either with brute force in a EVT_SIZE handler or with sizers
or something. OTOH, I bet you would get what you want if you take out hte
extra wxPanel and just make the TestListCtrlPanel a child of the notebook
and add it to the notebook.

Look in wxPython/demo/wxNotebook.py for an example.

路路路

--
Robin Dunn
Software Craftsman
robin@AllDunn.com Java give you jitters?
http://wxPython.org Relax with wxPython!