On Oct 11, 2011, at 12:28 PM, Adam wrote:
> Maybe I should be using dImage instead of dBitmap. I am creating the
> bitmap as a numpy array and then converting to a wxBitmap object:
>
> def arrayToBitmap(self, array):
> width = len(array[0])
> height = len(array)
> image = wx.EmptyImage(width,height)
> image.SetData(array.tostring())
> image.Rescale(width*10,height*10)
> wxBitmap = image.ConvertToBitmap()
> return wxBitmap
>
> Then using dBitmap.drawBitmap(wxBitmap) to set the control. Maybe you
> can suggest a better way than having to do this every time I want to
> update the image.
dImage supports streams, but the only ones we've dealt with had already
been converted to wx.Image objects, akin to the point after the SetData() call
in your routine.
One of the goals of dImage is to eliminate the need to mess with the
internals of wxPython image manipulation, so I would certainly like to add
direct support for something like this, so that you could simply do:
img = dabo.ui.dImage(self, Picture=array, ScaleMode="stretch")
I don't use numpy, so let me ask this: how would the dImage Picture
setter be able to recognize that it is being passed such an array?
-- Ed Leafe
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message:
http://leafe.com/archives/byMID/[email protected]