Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.


wxFramePanel... wx.Panel... wx.Window... ???

  • Chelonian

    I am confused as to the differences of these different options and when to use them:

    How is a wx.Window different from wx.Panel?

    When would you use wxFramePanel instead of wx.Panel? 

    Lastly, having saved a wxFramePanel to a file, how can you use AddPage() to add it to a wxNotebook?  I just don't understand the syntax of doing that.

    • Hi,

      - wx.Window is a base class, I don't think that I ever used it directly.

      - wx.Panel is a container on which you put other controls

      - wxFramePanel allows you to create a "free standing" wx.Panel.  In Python speak it allows you to create a module with a wx.Panel

      When you create a wxFramePanel module for a page you later want to use in a notebook you will have to import this module into the one with your notebook.

      E.g. in my code I have:

      from panelvintage import *
      self.vintageDetails = vintageDetail(id=-1, name='Vintage Details',
                                              pos=-1, size=-1, style=wx.TAB_TRAVERSAL,
      self.notebook1.AddPage(self.vintageDetails, _('Vintages'), False)

      # vintageDetail is a wx.Panel in the module panelvintage

      So, the wxFramePanel you use when you want to create a module with a wx.Panel in it which you then import/use in other place(s).

      A wx.Panel (in Boa on the Container Palette Tab) you use if you want to drop a wx.Panel onto e.g. a wx.Frame, or onto a wx.Splitter etc etc.

      Hope this helps

      • Chelonian

        Werner thanks again. 

        I poked around with this today, and I like the idea of being able to work on a panel of a notebook as its own module; it strikes me as a better way to keep things organized at least in some cases.

        But it seems that using this approach runs into some problems with using the Designer.  That is, if I add the references to the panel module, I can run the wxApp successfully but if I try to view it in the Designer, the Designer can't draw it and gives an AttributeError. 

        Is there any trick to get around this problem so that one can view a notebook in the Designer with all its child panels, even if some of those panels are modules? (my guess is no, but it'd be nice).