I'm painting bmp from internet on a dc, and I need to put over the dc
an animate ctrl while it download the image,
the only I don't know how to do is to put the animate ctrl over de dc.
class Panel_Fotos(wx.Panel):
def __init__(self,parent,fotos = []):
wx.Panel.__init__(self,parent,-1)
self.fotos = fotos
self.foto = Panel_DC(self,images.Xphoto.getBitmap())
ani =
wx.animate.Animation(os.path.join(c.sys_path,"recursos","images","loading.gif"))
self.ctrl = wx.animate.AnimationCtrl(self, -1, ani,size=
self.GetClientSize())
Tsizer = wx.BoxSizer(wx.VERTICAL)
Tsizer.Add(self.foto,1,wx.wx.EXPAND| wx.CENTER)
self.SetSizer(Tsizer)
Tsizer.Fit(self)
def Loading(self):
self.ctrl.Play()
def Load_Fotos(self,fotos):
self.fotos = fotos
if fotos :
if not fotos[0] == None:
bmp = wx.Bitmap(fotos[0],wx.BITMAP_TYPE_ANY)
else:
bmp = images.Xphoto.getBitmap()
self.foto.pic = bmp
self.Refresh()
self.ctrl.Stop()
class Panel_DC (wx.Panel):
def __init__(self, parent, pic = None, thumb = True, Size =
(50,50)):
wx.Panel.__init__(self, parent, -1)
self.pic = pic
self.thumb = thumb
self.Bind(wx.EVT_PAINT, self.OnPaint)
self.Bind(wx.EVT_MOVE, self.OnResize)
self.Bind(wx.EVT_SIZE, self.OnResize)
self.SetMinSize(Size)
def OnPaint(self, evt):
dc = wx.PaintDC(self)
dc.Clear()
imsize = size = self.GetClientSize()
if self.thumb == True: imsize = size -[10,10]
img = images.thumbnail(self.pic, imsize)
w = ((size[0])- img.Size[0] )/ 2
h = ((size[1]) - img.Size[1] )/ 2
dc.DrawBitmap(img,w,h, True)
def OnResize(self,event):
self.Refresh()
Thanks