0
是否有人知道如何讓同一個網格的多個實例顯示在一個框架上?每當我創建同一個對象的多個實例時,原始網格控件的顯示完全崩潰,我無法對它做任何事情。WxPython多個網格實例
僅供參考,下面的代碼:
import wx
import wx.grid as gridlib
class levelGrid(gridlib.Grid):
def __init__(self, parent, rows, columns):
gridlib.Grid.__init__(self, parent, -1)
self.moveTo = None
self.CreateGrid(rows, columns)
self.SetDefaultColSize(32)
self.SetDefaultRowSize(32)
self.SetColLabelSize(0)
self.SetRowLabelSize(0)
self.SetDefaultCellBackgroundColour(wx.BLACK)
self.EnableDragGridSize(False)
class mainFrame(wx.Frame):
def __init__(self, parent, id, title):
wx.Frame.__init__(self, parent, id, title, size=(768, 576))
editor = levelGrid(self, 25, 25)
panel1 = wx.Panel(editor, -1)
#vbox = wx.BoxSizer(wx.VERTICAL)
#vbox.Add(editor, 1, wx.EXPAND | wx.ALL, 5)
#selector = levelGrid(self, 1, 25)
#vbox.Add(selector, 1, wx.EXPAND |wx.BOTTOM, 5)
self.Centre()
self.Show(True)
app = wx.App()
mainFrame(None, -1, "SLAE")
app.MainLoop()