python - wxPython show image certain amount of time -


i using code in wxpython show images. created screen 2 panels, 1 left , right. in 1 of panels (randomly chosen), want display image 150ms. how can program this? relatively new python, , don't find clear way on internet.

my code (without 150ms):

    import wxversion     wxversion.select("3.0")     import wx     import random     import timeclass screen_1(wx.dialog):     ri  = 0     def __init__(self,parent,id,title):     wx.dialog.__init__(self,parent,id,title,size=(400,300))      self.randomimage = random.randrange(1,3)      self.randomslot = random.randrange(1,3)      screen_1.ri = self.randomimage      if(self.randomslot == 1):         self.side = 'left'     else:         self.side = 'right'       file = open('user.txt','a')     panel_left = wx.panel(self,11,(-1,-1),(200,200))      self.picture_left = wx.staticbitmap(panel_left)      font = wx.font(13,wx.default,wx.normal,wx.bold)     panel_centre = wx.panel(self,12,(200,70),(10,100))     msg = wx.statictext(panel_centre,-1,'+',size=(10,100))     msg.setfont(font)      panel_right = wx.panel(self,13,(210,0),(200,200))      self.picture_right = wx.staticbitmap(panel_right)      **self.imagename = 'im_'+str(self.randomimage)+'.png'**      if self.randomslot == 1:         self.picture_left.setbitmap(wx.bitmap(self.imagename))     else:         self.picture_right.setbitmap(wx.bitmap(self.imagename))     wx.futurecall(1000,self.destroy)     self.centre()     self.showmodal()  def onclick(self,event):     self.close() 

thanks lot!

def ontimeup(self,e):    #change images    self.timer.start(15,oneshot=true) # if want call again in 15 ms def starttimer(self):    self.timer = wx.timer()    self.timer.bind(wx.evt_timer,self.ontimeup)    self.timer.start(15,oneshot=true) 

something ... although 15ms fast ...


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -