2007-04-12, 15:31
can somone tell me the right way to add ControlImage in a for loop
this is what i have trying for days
it seems to add the ControlImage ok, but i get an error if i try and remove them
thanks
this is what i have trying for days
it seems to add the ControlImage ok, but i get an error if i try and remove them
thanks
Code:
##Add Control
## range(len(test[id][2:])): = [0, 1, 2]
for i in range(len(test[id][2:])):
testpicture='testpicture'+str(i)
x = 300 - 30/2 + 6*30 - int(test[id][2:][i][1])*30
y = 200 - 30/2 - 50/2 + int(test[id][2:][i][2])*50
self.testpicture =xbmcgui.ControlImage(x,y,30,30, RootDir + str(test[id][2:][i][0])+".png")
self.addControl(self.testpicture)
##Add Control Debug Output
##print self.testpicture = <xbmcgui.ControlImage instance at 0x033CEA30>
##print testpicture = testpicture0
##print self.testpicture = <xbmcgui.ControlImage instance at 0x033CEB48>
##print testpicture = testpicture1
##print self.testpicture = <xbmcgui.ControlImage instance at 0x033CEC38>
##print testpicture = testpicture2
##Finish Add Control
##Remove Control
self.removeControl(self.testpicture0)
self.removeControl(self.testpicture1)
self.removeControl(self.testpicture2)
##Finish Remove Control Debug Output
AttributeError: MyClass instance has no attribute 'testpicture0'
##Finish Remove Control