Hello i have extend wxPanel to create a template like this
import wx
class Age(wx.Panel):
""" Template per gestione Anagrafiche"""
def __init__(self, parent, id,content,content,size = wx.DefaultSize):
wx.Panel.__init__(self, parent, id, wx.Point(0, 0), size, wx.SUNKEN_BORDER)
## Create the vertical sizer for the toolbar and Panel
self.box = wx.BoxSizer(wx.VERTICAL)
tb = _NavigationTool(self)
self.box.Add(tb,0,wx.ALL | wx.ALIGN_LEFT | wx.EXPAND,4)
self.addcontent(content)
self.box.Fit(self)
self.SetAutoLayout(True)
self.SetSizer(self.box)
def addcontent(self,content):
self.box.Add(content,1,wx.EXPAND)
class _NavigationTool(wx.ToolBar):
def __init__(self, parent, *args, **kwargs):
wx.ToolBar.__init__(self, parent, *args, **kwargs)
#add other code here
tsize = (16,16)
self.SetToolBitmapSize(tsize)
new_bmp = wx.ArtProvider.GetBitmap(wx.ART_NEW, wx.ART_TOOLBAR, tsize)
open_bmp = wx.ArtProvider.GetBitmap(wx.ART_FILE_OPEN, wx.ART_TOOLBAR, tsize)
copy_bmp = wx.ArtProvider.GetBitmap(wx.ART_COPY, wx.ART_TOOLBAR, tsize)
paste_bmp= wx.ArtProvider.GetBitmap(wx.ART_PASTE, wx.ART_TOOLBAR, tsize)
self.AddLabelTool(10, "New", new_bmp, shortHelp="New", longHelp="Long help for 'New'")
self.AddLabelTool(20, "Open", open_bmp, shortHelp="Open", longHelp="Long help for 'Open'")
self.AddSimpleTool(30, copy_bmp, "Copy", "Long help for 'Copy'")
self.AddSimpleTool(40, paste_bmp, "Paste", "Long help for 'Paste'")
then I have extend this and i make another clas like this
import wx
import Main.View.Template
class Customer(Main.View.Template.Age):
def __init__(self, parent,id):
c= content(self,-1)
Main.View.Template.Age.__init__(self, parent,id,c)
class content(wx.Panel):
""" Pannello contente controlli per anagrafica clienti"""
def __init__(self, parent, id, size = wx.DefaultSize):
wx.Panel.__init__(self, parent, id, wx.Point(0, 0), size, wx.SUNKEN_BORDER)
vsizer = wx.BoxSizer(wx.VERTICAL)
hsizer1 = wx.BoxSizer(wx.HORIZONTAL)
lbl = wx.StaticText(self, -1 ,"Nome Ditta/Anno")
txt = wx.TextCtrl(self, -1)
txt2 = wx.TextCtrl(self, -1)
btn = wx.Button(self, -1, "&Connetti")
btn2 = wx.Button(self, -1, "&Disconnetti")
btn3 = wx.Button(self, -1, "C&alcola")
btn4 = wx.Button(self, -1, "&Esporta")
hsizer1.Add(lbl, 1, wx.ALL , 5)
hsizer1.Add(txt, 2, wx.ALL , 5)
hsizer1.Add(txt2, 3, wx.ALL ,5)
hsizer1.Add(btn, 1, wx.ALL , 5)
hsizer1.Add(btn2, 1, wx.ALL ,5)
hsizer1.Add(btn3, 1, wx.ALL ,5)
hsizer1.Add(btn4, 1, wx.ALL ,5)
vsizer.Add(hsizer1, 1, wx.ALL)
my problem is the content class because i can't pass self to this class imust pass parent but is not corret can somone help me