Jack_of_All_Trades
Jack_of_All_Trades

Reputation: 11498

embedding grid in panel in wxpython

What is the proper way to embedd grid (wx.grid.Grid) into the panel? I tried the following code and got bizarre frame:

    wx.Frame.__init__(self,wx.GetApp().TopWindow,size=(600,800),title='Material Properties')
    self.GridPanel=wx.Panel(self,-1)

    grid=wx.grid.Grid(self.GridPanel,-1)
    grid.CreateGrid(10,10)

I cannot see an easy way to create a grid which can also have buttons as well as menubar and other related widgets. Is there any example which shows GUI of how to implement wx.grid to achieve some sort of spreadsheet which has tabs on it for manipulation. I seem to be lost on this. I want to create two different grid and also want to add some buttons and additional functionalites to the frame containing the table. Is there any better way to do that in wxpython?

Upvotes: 3

Views: 7495

Answers (1)

Mike Driscoll
Mike Driscoll

Reputation: 33101

I wrote about grids quite a while ago on my blog. You might find the following articles helpful for putting a Grid onto a Panel:

Once you have that figured out, you can easily put the panel into a Notebook. If you want to add buttons, create the buttons and then add them to the sizer (see second example). Adding a Toolbar to the frame is covered in the wxPython demo, but I covered it here too:

Upvotes: 4

Related Questions