[Tutor] create an empty array of images

bob gailer bgailer at gmail.com
Sat Jan 3 22:20:18 CET 2009

i i wrote:
> Hi tutor,
>             thanks for the help ,u dont understand cause i have given 
> the psudo code,i have not given the full code only apart of it.  I 
> only want an emptty array and  put the value [i] in it. This [i] value 
> is the one that i want to show.Im making this activity in glade ,the 
> set function in image widget do not replace the previous value but in 
> the next loop it shows the previous images as well as the new one .It 
> dont replace,but set again and again. So i want to declare an empty 
> array then i want to give it a value[i] ,this [i] is the number of 
> images that i want to show, but on next loop i want the array to be 
> empty,and then sets new value of [i].
>         self.fixed = self.wTree.get_widget("fixed1")       
>         self.numOne = random.randint(1,10)
>     for i in [ ]:
>         for i in range(self.numOne):

Don't use i as the loop variable for the inner for. Pick some other name.

>             a = [i]
>             self.image = gtk.Image()
>             self.image.set_from_file("./Pink-Flower-32x32.png")
>             self.fixed.put(self.image, i*25, 0)
>             self.image.show()

Bob Gailer
Chapel Hill NC 

More information about the Tutor mailing list