Putting a MegaGrid in a sizer

Hey everyone,

I’m trying to put a MegaGrid in a sizer, but upon doing so it breaks the grid (it no longer shows anything). Here’s an example:

#small app

import wx, MegaGrid

class MainFrame(wx.Frame):

def __init__(self):

	wx.Frame.__init__(self, None, -1, "MEGAGRID")

	self.panel1 = wx.Panel(self, -1)

	self.panel2 = wx.Panel(self, -1)

	data = []

	cols = ["Test1", "Test2"]

	MGrid = MegaGrid.MegaGrid(self.panel2, data, cols, {})

	sizer = wx.BoxSizer(wx.VERTICAL)

	sizer.Add(self.panel1, wx.TOP|wx.EXPAND)

	sizer.Add(self.panel2, wx.BOTTOM|wx.EXPAND)

	self.SetSizer(sizer)

	self.SetAutoLayout(True)

	self.Show()

#this one works

class MainFrame2(wx.Frame):

def __init__(self):

	wx.Frame.__init__(self, None, -1, "MEGAGRID")

	data = []

	cols = ["Test1", "Test2"]

	MGrid = MegaGrid.MegaGrid(self, data, cols, {})

	self.Show()

app = wx.App(False)

frame = MainFrame()

frame = MainFrame2()

#F = DrawFrame(None, title=“FloatCanvas Demo App”, size=(700,700) )

app.MainLoop()

One way I am able to circumvent this is to sublcass the megagrid, but upon doing so it loses all scroll bars. Is there an obvious way to put a megagrid on a panel that i’m missing?

Thanks,

Chris

Hi,

Hey everyone,

I'm trying to put a MegaGrid in a sizer, but upon doing so it breaks the
grid (it no longer shows anything). Here's an example:

#small app
import wx, MegaGrid

class MainFrame(wx.Frame):
def __init__(self):
wx.Frame.__init__(self, None, -1, "MEGAGRID")
self.panel1 = wx.Panel(self, -1)
self.panel2 = wx.Panel(self, -1)
data =
cols = ["Test1", "Test2"]
MGrid = MegaGrid.MegaGrid(self.panel2, data, cols, {})

megaSizer = wx.BoxSizer(wx.VERTICAL)
megaSizer.Add(MGrid, 1, wx.EXPAND)
self.panel2.SetSizer(megaSizer)

sizer = wx.BoxSizer(wx.VERTICAL)
sizer.Add(self.panel1, wx.TOP|wx.EXPAND)
sizer.Add(self.panel2, wx.BOTTOM|wx.EXPAND)
self.SetSizer(sizer)
self.SetAutoLayout(True)
self.Show()
#this one works
class MainFrame2(wx.Frame):
def __init__(self):
wx.Frame.__init__(self, None, -1, "MEGAGRID")
data =
cols = ["Test1", "Test2"]
MGrid = MegaGrid.MegaGrid(self, data, cols, {})
self.Show()
app = wx.App(False)
frame = MainFrame()
frame = MainFrame2()
#F = DrawFrame(None, title="FloatCanvas Demo App", size=(700,700) )
app.MainLoop()

One way I am able to circumvent this is to sublcass the megagrid, but upon
doing so it loses all scroll bars. Is there an obvious way to put a
megagrid on a panel that i'm missing?

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/

···

On 3 July 2012 16:59, Chris Mitchell wrote: