Saturday, 24 August 2013

I don't how know to set panels + grid in a frames with wxpython

I don't how know to set panels + grid in a frames with wxpython

I have this python code my problem with wxpython I use last wxpython with
2.7 python.
What should I do if I want to use the commented code and use more panels,
being the grid visible?
I tried it in many ways, and I'm totally unable to do anything. The
problem is that the application crashes, or it doesn't shows properly.
import wx
import wx.grid as gridlib
class MyGrid(gridlib.Grid):
""""""
#----------------------------------------------------------------------
def __init__(self, parent):
"""Constructor"""
gridlib.Grid.__init__(self, parent)
self.CreateGrid(2, 3)
# test all the events
//Code for events
########################################################################
class MyForm(wx.Frame):
""""""
#----------------------------------------------------------------------
def __init__(self):
"""Constructor"""
wx.Frame.__init__(self, parent=None, title="An Eventful
Grid",size=(700,700))
p = wx.Panel(self)
# IF I UNCOMMNT THIS ,IT DOESNT LOADS THE WINDOW OR GRID APPEARS
CORRUPTED
#self.panel = p1 = wx.Panel(self,pos=(0,200),size=(100,100))
#button2 = wx.Button(p1, -1, label="click me")
#wx.StaticText(p, -1,"Right-click on the panel to show a popup
menu",(100,100))
#self.panel = p2 = wx.Panel(self,pos=(200,200),size=(400,200))
myGrid = MyGrid(p)
sizer = wx.BoxSizer(wx.VERTICAL)
sizer.Add(myGrid, 1, wx.EXPAND)#,pos=(200,200)
#sizer.Add(p2, 2, wx.EXPAND)
p.SetSizer(sizer)
if __name__ == "__main__":
app = wx.PySimpleApp()
frame = MyForm().Show()
app.MainLoop()

No comments:

Post a Comment