Все, что я пытаюсь сделать, это иметь 2 класса
1 - создает сетку
2- берет сетку и помещает ее в wx.notebook
так что в основном один класс создает сетку, а другой класс принимает сетку в качестве параметра и добавляет ее в wx.notebook
но я получаю сообщение об ошибке
self.m_grid1 = wx.grid.Grid(self) TypeError: Grid(): arguments did not match any overloaded call:
overload 1: too many arguments
overload 2: argument 1 has unexpected type 'reportGrid'
и вот код для класса Grid называется
reportGrid
class reportGrid ():
def __init__( self, list):
self.m_grid1 = wx.grid.Grid(self)
self.m_grid1.Create(parent = None, id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.WANTS_CHARS, name="Grid")
# Grid
self.m_grid1.CreateGrid( 7, 18 )
self.m_grid1.EnableEditing( True )
self.m_grid1.EnableGridLines( True )
self.m_grid1.SetGridLineColour( wx.SystemSettings.GetColour( wx.SYS_COLOUR_WINDOWTEXT ) )
self.m_grid1.EnableDragGridSize( True )
self.m_grid1.SetMargins( 0, 0 )
# Columns
self.m_grid1.EnableDragColMove( False )
self.m_grid1.EnableDragColSize( True )
self.m_grid1.SetColLabelSize( 30 )
self.m_grid1.SetColLabelAlignment( wx.ALIGN_CENTRE, wx.ALIGN_CENTRE )
# Rows
self.m_grid1.EnableDragRowSize( True )
self.m_grid1.SetRowLabelSize( 80 )
self.m_grid1.SetRowLabelAlignment( wx.ALIGN_CENTRE, wx.ALIGN_CENTRE )
# Label Appearance
self.m_grid1.SetColLabelValue(0, "Yield")
self.m_grid1.SetColLabelValue(1, "64CU")
self.m_grid1.SetColLabelValue(2, "Yield")
self.m_grid1.SetColLabelValue(3, "60CU")
self.m_grid1.SetColLabelValue(4, "Chain")
self.m_grid1.SetColLabelValue(5, "Logic")
self.m_grid1.SetColLabelValue(6, "Delay")
self.m_grid1.SetColLabelValue(7, "BIST")
self.m_grid1.SetColLabelValue(8, "CREST")
self.m_grid1.SetColLabelValue(9, "HSIO")
self.m_grid1.SetColLabelValue(10, "DC-Spec")
self.m_grid1.SetColLabelValue(11, "HBM")
self.m_grid1.SetColLabelValue(12, "OS")
self.m_grid1.SetColLabelValue(13, "PS")
self.m_grid1.SetColLabelValue(14, "Alarm")
self.m_grid1.SetColLabelValue(15, "JTAG")
self.m_grid1.SetColLabelValue(16, "Thermal IDD")
self.m_grid1.SetColLabelValue(17, "Insuff Config")
self.m_grid1.SetRowLabelValue(0, "Today")
self.m_grid1.SetRowLabelValue(1, "WTD")
self.m_grid1.SetRowLabelValue(2, "WW45")
self.m_grid1.SetRowLabelValue(3, "WW44")
self.m_grid1.SetRowLabelValue(4, "WW43")
self.m_grid1.SetRowLabelValue(5, "Monthly")
self.m_grid1.SetRowLabelValue(6, "QTD")
# Cell Defaults
for i in range(len(list)):
for j in range(len(list[i])):
self.m_grid1.SetCellValue(i,j, list[i][j])
self.m_grid1.SetDefaultCellAlignment( wx.ALIGN_LEFT, wx.ALIGN_TOP )
а вот класс, который принимает его в качестве параметра и предполагает создание блокнота
class reportFrame ( wx.Frame ):
def __init__( self, parent , grid1):
wx.Frame.__init__ ( self, parent, id = wx.ID_ANY, title = u"Report", pos = wx.DefaultPosition, size = wx.Size( 7990,210 ), style = wx.DEFAULT_FRAME_STYLE|wx.TAB_TRAVERSAL )
self.SetSizeHints( wx.DefaultSize, wx.DefaultSize )
bSizer6 = wx.BoxSizer( wx.VERTICAL )
self.m_notebook1 = wx.Notebook( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, 0 )
self.m_notebook1.SetBackgroundColour( wx.SystemSettings.GetColour( wx.SYS_COLOUR_INFOBK ) )
self.m_panel2 = wx.Panel( self.m_notebook1, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL )
bSizer14 = wx.BoxSizer( wx.HORIZONTAL )
bSizer14.Add( grid1, 0, wx.ALL, 5 )
self.m_panel2.SetSizer( bSizer14 )
self.m_panel2.Layout()
bSizer14.Fit( self.m_panel2 )
self.m_notebook1.AddPage( self.m_panel2, u"a page", False )
self.m_panel3 = wx.Panel( self.m_notebook1, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL )
bSizer17 = wx.BoxSizer( wx.VERTICAL )
bSizer17.Add( grid1, 0, wx.ALL, 5 )
self.m_panel3.SetSizer( bSizer17 )
self.m_panel3.Layout()
bSizer17.Fit( self.m_panel3 )
self.m_notebook1.AddPage( self.m_panel3, u"a page", True )
bSizer6.Add( self.m_notebook1, 1, wx.EXPAND |wx.ALL, 3 )
self.SetSizer( bSizer6 )
self.Layout()
self.Centre( wx.BOTH )
self.Show(show=True)