All pastes #988932 Raw Edit

Miscellany

public text v1 · immutable
#988932 ·published 2008-04-17 23:55 UTC
rendered paste body
#!/usr/bin/python
import wx
import cStringIO,time
x=1
class Panel1(wx.Panel):
 """ class Panel1 creates a panel with an image on it, inherits wx.Panel """
 def __init__(self, parent, id):
  wx.Panel.__init__(self, parent, id)
  imageFile = 'foo.jpg'
  jpg1 = wx.Image(imageFile, wx.BITMAP_TYPE_ANY).ConvertToBitmap()
  wx.StaticBitmap(self, -1, jpg1, (10 + jpg1.GetWidth(), 5), (jpg1.GetWidth(), jpg1.GetHeight()))
  timer = wx.Timer(self) 
  self.Bind(wx.EVT_TIMER, self.OnTimer, timer) 
  timer.Start(1)
 
 def OnTimer(self):
  global x
  print x
  wx.StaticBitmap(self, -1, jpg1, (x + jpg1.GetWidth(), x), (jpg1.GetWidth(), jpg1.GetHeight()))
  x+=1

app = wx.PySimpleApp()
frame1 = wx.Frame(None, -1, "An image on a panel", size = (400, 300))
Panel1(frame1,-1)
frame1.Show(1)
app.MainLoop()