sqlite3 - Cant display a BLOB picture to BitmapButton python -
my class
class mydb(): def __init__ (self): self.conn = sqlite3.connect('c:\\lab\\pictures.db') def queryf(self,q): c = self.conn.cursor() c.execute(q) data = c.fetchone() return data[0]
using mydb class
.... q = "select file t_pictures id = 1;" db = mydb() _data = db.queryf(q) start_image = wx.image(_data) start_image.rescale(150, 100) image = wx.bitmapfromimage(start_image) self.bitmap_button_1 = wx.bitmapbutton(self, wx.id_any,image)
the error
typeerror: string or unicode type required
def onbutton_1(self,event): q = "select file t_pictures id = 1;" db = mydb() _buffer = db.queryf(q) stream = cstringio.stringio(_buffer) image = wx.imagefromstream(stream) _pic = wx.bitmapfromimage(image.rescale(150, 100)) self.bitmap_button_1 = wx.bitmapbutton(self, wx.bitmap_type_any,_pic)
Comments
Post a Comment