我有这个 python 代码我的 wxpython 问题 我在 Python 2.7 中使用了最后一个 wxpython。
如果我想使用注释代码并使用更多面板,网格可见,我该怎么办?
我尝试了很多方法,但我完全无能为力。问题是应用程序崩溃,或者它没有正确显示。
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()