I have an image drawn using PIL in python.
import Image
import ImageDraw
createCM():
img = Image.new("RGB", (400,400), "white")
draw = ImageDraw.Draw(img)
coords = [(100,70), (220, 310), (200,200)]
dotSize = 2
for (x,y) in coords:
draw.rectangle([x,y,x+dotSize-1,y+dotSize-1], fill="black")
Want i want to do now is show this on my wxpython panel.
I started off like this
CMchart = createCM(self)
self.vbox = wxBoxSizer(wx.VERTICAL)
self.vbox.Add(CMchart, 1, wx.LEFT | wx.TOP | wx.GROW)
self.vbox.AddSpacer(25)
self.SetSizer(self.vbox)
self.vbox.Fit(self)
This does’t show anything. Just want to know where I am going wrong
Thank you
without knowing what createcM does it is really difficult to know how to help you. But the short of it is that to draw an Image you load the data from a wx.Image turn it into a wx.Bitmap and then draw it using a DeviceContext. Typically first draw it a wx.MemoryDC first the when you have finished all your drawing updates you then use a wx.PaintDC or a wx.ClientDC to draw it. Take a look it
http://wiki.wxpython.org/WorkingWithImages#PIL_.28Python_Imaging_Library.29
which gives you a good example of how to load images from PIL