From: Andrew P <gr...@gm...> - 2005-09-27 17:02:14
|
Hello, I have a program that spits out an array like: [[1 1 1 1 0] [1 1 1 0 0] [0 1 0 0 0] [0 0 1 0 1] [1 1 0 0 0]] Does anybody have a suggestion about the quickest way to draw this? I'm really very new at this. I'm just trying to avoid looping over each element in the array to create a new array with RGB values, since I want to have this animate as it draws, and scroll. This is for cellular automata, i= n case anybody cares :) I've tried this in the debugger shell with a 100x100 array: >>>img =3D wx.EmptyImage(100,100) >>>img.SetData(a.tostring()) Traceback (most recent call last): File "<input>", line 1, in ? File "C:\Python24\Lib\site-packages \wx-2.6-msw-unicode\wx\_core.py", line 2652, in SetData return _core_.Image_SetData(*args, **kwargs) ValueError: Invalid data buffer size. I saw the drawPointList method, but I don't see a way to get from a 2D arra= y to a what looks like a list of x,y pairs? Is that what it wants? Something like [[0,1],[0,2],[0,4]] instead of [0,1,1,0,1]? Either way, that doesn't seem like a very direct method coming from an array, but I could be way off here. I don't see a way to quickly get to that point tho. Thanks for any help, Andrew |