Kartic Krish wrote:
Michele,
Like Horst mentioned, please take a look at Grid_MegaExample.py.
I too use a grid modelled after Grid_MegaExample and it works without
delays (just the vanilla version, adding attributes is another ball game). If you could post your code, I can take a look at it and let you know, in my limited experience, what you can do to make it
faster.
That grid is the application heart, so for post it I have to post all
the app :), but I can recreate the problem with this:
import wx, random
import wx.grid
class Frame1(wx.Frame):
def __init__(self, parent):
wx.Frame.__init__(self, parent, size=wx.Size(800,600))
sz = wx.BoxSizer(wx.VERTICAL)
b1 = wx.Button(self, label='button1')
self.gr = wx.grid.Grid(self)
self.cols, self.rows = 10, 4000
sz.Add(b1, 0, 0)
sz.Add(self.gr, 1, wx.EXPAND)
self.gr.CreateGrid(self.rows, self.cols)
self.SetSizerAndFit(sz)
wx.FutureCall(500, self.create)
def create(self):
import time
t = time.time()
for row in range(self.rows):
for col in range(self.cols):
self.gr.SetCellValue(row, col, str(row+col))
print time.time() - t
if __name__ == '__main__':
app = wx.App(0)
frame = Frame1(None)
frame.Show(True)
app.MainLoop()
On my pc it take 0.7/0.8 sec, on 800MHz it take 3.5/4.0 sec.
Like I already said, I try with PyGridTableBase, but I need to use
functions like AppendCols and DeleteCols that apparently cannot be used
with that class (I don't know why).
In your project, do you use they (AppendCols, AppendRows, ...)?
Thanks, -Kartic
Thanks to you,
Michele