Re: [Tutor] Weird Python Error

2013-10-18 Thread Alan Gauld
On 17/10/13 21:09, Zaid Saeed wrote: class YellowCar(pygame.sprite.Sprite): def __init__(self): pygame.sprite.Sprite.__init__(self) self.image = pygame.image.load("yellow.png") self.image = pygame.transform.scale(self.image,(50, 75)) self.rect = self.imag

[Tutor] Nested lists help

2013-10-18 Thread Corinne Landers
Hi, I'm trying to create a 3D grid, so I'm using a list of list of lists. However, if I try to make a change to one value, eggrid[0][1][2] = 3, It doesn't just change list[0], it change the 2nd element in the 1st list of every list? I think it's because I've copied lists to get the grid, but co

Re: [Tutor] Nested lists help

2013-10-18 Thread Steve Willoughby
On 18-Oct-2013, at 17:13, Corinne Landers wrote: > self.grid_x = x > self.grid_y = y > self.grid_z = z > > self.grid = [] > self.grid2D = [] > So here you create a list, self.grid2D. > for i in range(self.grid_y): > row = [0]*x > self.grid2D.append(row) > Here you a

Re: [Tutor] Nested lists help

2013-10-18 Thread Dave Angel
On 18/10/2013 20:13, Corinne Landers wrote: > --> > Hi, I'm > trying to create a 3D grid, so I'm using a list of list of > lists. However, if I try to make a change to one value, > eggrid[0][1][2] = 3, It doesn't just change > list[0], it change the 2nd element in the 1st list of every > lis