PDA

View Full Version : Newb needs advice on image looping


Spoetzl
2006-08-05, 18:00
This Python newb needs some image looping advice for the code extracts below. What is the best/easiest method to have a script simply rotate through fullscreen images in a loop (ala slideshow)? I've seen so many strange examples in scripts (that no longer work anyways) that I've confused myself. :sniffle: I had limited success with some very forced methods, but I would like to learn the recommended way now.

# extracted from MyClass
def showImage(self):
self.screen_image = xbmcgui.ControlImage(0,0, int(720*self.scaleX),int(480*self.scaleY), self.Pic)
self.addControl(self.screen_image)
time.sleep(10)
#self.removeControl(self.screen_image) # remove prevents domodal from seeing it. Only use adds without removes?
#self.close()


# from main loop
w = MyClass()
try:
X = 0
while not w.dying:
w.Pic = new_image_list[X]
#w.showImage() # Call it from here or in the Class init ???
w.doModal()
x += 1
if X == len(new_image_list):
X = 0
except:
print "Looping error"
del w

Nuka1195
2006-08-05, 18:35
If you don't just want to use the slideshow, I would use the setImage() method.

I would probably use the threading.Timer class to call a function that uses setImage().

http://home.no.net/thor918/xbmc/xbmcgui.html for the setImage().