Re: Using a wxPanel subclass

Carsten Grohmann <[email protected]>
Newsgroups gmane.comp.python.wxglade
Message-ID <[email protected]>
Hi Federico,

Federico Fanton schrieb am 21.12.2016:
> Is it possible to tell wxGlade to use a custom class instead of
> wxPanel? I've tried changing the "Class" field but wxGlade generates
> a new file with the class definition... I just want something like
> 
> from mystandardpanels import MyCustomPanel
> self.pnl_main = MyCustomPanel(self, wx.ID_ANY)
> 
> instead of
> 
> self.pnl_main = wx.Panel(self, wx.ID_ANY)
> 
> with MyCustomPanel being a class that already exists.

You can do two further steps:
 1) Check "Don't generate code for this class". in Panels "Widget" tab.
    to prevent generating the class definition.
 2) Add an manual import for your class in the "Code" tab.

The attached example generates code like this:

# begin wxGlade: extracode
from mystandardpanels import MyCustomPanel
# end wxGlade


class MyFrame(wx.Frame):
    def __init__(self, *args, **kwds):
        # begin wxGlade: MyFrame.__init__
        wx.Frame.__init__(self, *args, **kwds)
        self.panel_1 = MyCustomPanel(self, wx.ID_ANY)

        self.__set_properties()
        self.__do_layout()
        # end wxGlade

HTH,
Carsten

------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today.http://sdm.link/intel

_______________________________________________
wxGlade-general mailing list
wxGlade-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/wxglade-general
examle.wxg (application/octet-stream, 1.2 KB) - not displayed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.