ObjectListView in Toolbar

  • Robert Kamarowski

    Is there a way for ObjectListView components to be availabel from the boa toolbar?

    thank you,
    bob k.

  • Werner F. Bruhin

    Hi Bob,

    Not directly without quit a bit of work, but you can you do it by using _custom_classes, I use this for all kind of controls I customize in some way.  For the OLV and DVC which I currently do some testing on I create Boa:FramePanel on which I manually code the ObjectListView, DataViewControl or similar and then add it to the frame by definining it like this:

    class Frame1(wx.Frame):
        _custom_classes = {'wx.ComboBox': ,
                           'wx.TextCtrl': ,
                           'wx.lib.masked.numctrl.NumCtrl': ,
                           'wx.Panel': ,}

            self.theList = PanelDVC(id=wxID_FRAME1THELIST, name=u'theList',
                  parent=self.splitterWindow1, pos=wx.Point(0, 0), size=wx.Size(776,
                  197), style=wx.SUNKEN_BORDER | wx.TAB_TRAVERSAL)

    You have to watch out that the custom classes behaves exactly the same as the base class in this case a wx.Panel.


  • Robert Kamarowski

    sounds a bit too advanced for me at this time.  but thank you for the info Werner.

  • Geoff Cook

    Geoff Cook - 2012-08-17

    I have a similar situation where I am trying to add an ObjectListView to Boa Constructor via the Frame Designer. I finally figured out how to add OLV to my Python library (which was an effort in itself, as I am new to Python and its permutations…)

    Anyway, I think I've followed the code design from Werner (above), but I keep getting errors. Here is the wx.Panel control (basic for now, I just want to get the basics working first):

    import wx
    from ObjectListView import ObjectListView
    [wxID_OLVPANEL] = [wx.NewId() for _init_ctrls in range(1)]
    class OLVPanel(wx.Panel):
        def _init_ctrls(self, prnt):
            wx.Panel.__init__(self, style=wx.TAB_TRAVERSAL, name='', parent=prnt, pos=wx.DefaultPosition, id=wxID_OLVPANEL, size=wx.Size(200, 100))
        def __init__(self, parent, id, pos, size, style, name):

    Here is the parent Frame (modified from the BC-generated code):

    import wx
    def create(parent):
        return PyK2Main(parent)
    ] = [wx.NewId() for _init_ctrls in range(2)]
    class PyK2Main(wx.Frame):
        _custom_classes = {'wx.Panel': ['OLVPanel'],}
        def _init_ctrls(self, prnt):
            # generated method, don't edit
            wx.Frame.__init__(self, id=wxID_PYK2MAIN, name=u'PyK2Main', parent=prnt,
                  pos=wx.Point(354, 140), size=wx.Size(1205, 760),
                  style=wx.DEFAULT_FRAME_STYLE, title=u'PyK2')
            self.SetClientSize(wx.Size(1189, 724))
            self.PlaylistPanel = OLVPanel(id=wxID_PYK2MAINPLAYLISTPANEL,
                  name=u'PlaylistPanel', parent=self, pos=wx.Point(0, 0),
                  size=wx.Size(1189, 724), style=wx.TAB_TRAVERSAL)
            self.PlaylistPanel.SetBackgroundColour(wx.Colour(18, 213, 13))
        def __init__(self, parent):

    When I try to run it, I get this error:


    Traceback (most recent call last):
      File "C:/Python27/boa-constructor-0.6.1/Program Files/PyK2/PyK2.py", line 22, in <module>
      File "C:/Python27/boa-constructor-0.6.1/Program Files/PyK2/PyK2.py", line 18, in main
        application = BoaApp(0)
      File "C:\Python27\lib\site-packages\wx-2.8-msw-unicode\wx\_core.py", line 7981, in __init__
      File "C:\Python27\lib\site-packages\wx-2.8-msw-unicode\wx\_core.py", line 7555, in _BootstrapApp
        return _core_.PyApp__BootstrapApp(*args, **kwargs)
      File "C:/Python27/boa-constructor-0.6.1/Program Files/PyK2/PyK2.py", line 12, in OnInit
        self.main = PyK2Main.create(None)
      File "C:/Python27/boa-constructor-0.6.1/Program Files/PyK2\PyK2Main.py", line 6, in create
        return PyK2Main(parent)
      File "C:/Python27/boa-constructor-0.6.1/Program Files/PyK2\PyK2Main.py", line 28, in __init__
      File "C:/Python27/boa-constructor-0.6.1/Program Files/PyK2\PyK2Main.py", line 22, in _init_ctrls
        self.PlaylistPanel = OLVPanel(id=wxID_PYK2MAINPLAYLISTPANEL,
    NameError: global name 'OLVPanel' is not defined

    Can anybody help me please? Thank you!


Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks