WxPython multiple grid instances

Posted by randomPythonHacker on Stack Overflow See other posts from Stack Overflow or by randomPythonHacker
Published on 2010-04-24T21:57:56Z Indexed on 2010/04/24 22:03 UTC
Read the original article Hit count: 244

Filed under:
|

Does anybody know how I can get multiple instances of the same grid to display on one frame? Whenever I create more than 1 instance of the same object, the display of the original grid widget completely collapses and I'm left unable to do anything with it.

For reference, here's the code:

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()

© Stack Overflow or respective owner

Related posts about wxpython

Related posts about grid