[wxpython-users] Wx.grid and importing text
Robin Dunn
robin at alldunn.com
Tue Apr 1 14:45:15 PDT 2008
giorgio.luciano at inwind.it wrote:
> Hello to all,
> I'm a newbie and even if I've read the book of wxpython and tried to use the help for wxpython I didn't succeed to solve my problem.
> I simply would like to import in a grid a txt file but it seems more diffocult than expected.
> first of all I would like to ask. Is better to use a pytable for that (I think at maximum I will have grids of 2000x4000) ?
Probably.
> then which command do I have to use
> is there something like setvalue in the txt editor ?
>
> should I manually write some code like
> [r,c]=a.size
> for i in arange (1,r)
> for k in arage (1,c)
> wx.gri1.Setvalue(i,k)
Yes. If you're not using your own table then you need to load all the
cell values into the grid's built-in table. The grid class has a
SetCellValue(row, col, value) method.
On the other hand, if you use your own table then you don't need to
preload all the data into the grid. Instead you just have it in
whatever Python data structure makes sense to you and then provide it to
the grid as it asks for the data values (as it needs them for display,
loading into a cell editor, etc.)
--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!
More information about the wxpython-users
mailing list