Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #45385
| References | (1 earlier) <5193CC16.80304@davea.name> <5193E8C0.1060004@davea.name> <CAPp_YbVBm2444Ea-pUy2Zn2YbB1mKmDoasmNXp7DPAbs8Sra4g@mail.gmail.com> <CAPp_YbVk4NwSxSpVEASCk0w=1mPoRii+RjccnXNLP+8igf3H2g@mail.gmail.com> <519425AC.3070605@davea.name> |
|---|---|
| Date | 2013-05-15 20:53 -0400 |
| Subject | Re: Question re: objects and square grids |
| From | Andrew Bradley <abradley201@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.1727.1368665595.3114.python-list@python.org> (permalink) |
[Multipart message — attachments visible in raw view] - view raw
> > > SQUARESIZE = 43 >>> >>> grid = [] >>> for row in range(10): >>> row_squares = [] >>> for column in range(20): >>> rect = Rect(12 + column * SQUARESIZE, 10 + row * SQUARESIZE, >>> SQUARESIZE, SQUARESIZE) >>> row_squares.append(rect) >>> grid.append(row_squares) >>> >>> It appears to be working (that is, the program still runs without >>> crashing). >>> >> > Sorry, but that's no criteria. Question is whether it's doing what you > want. Are the rows 20 across and are there 10 of them? Do the values of > each individual rect look right? print is your friend. Yes, I have gotten rid of that part with the 1, 2, 3, 4, etc., and now the code appears to be working up to [9][19]. Thank you very much. The coordinates all do look correct, and there are 200 rectangles when I do list(grid). > > > So now, how can I utilize this new grid list? Thank you for the >>> help so far, I feel like the entire grid is now being worked out. >>> -Andrew >>> >>> > That's a Pygame question, and I told you at the beginning, I can't really > help with that. I'd like to learn, but not this week. > > Others - can you show some minimal code to use these grid parameters to > color selected squares of the pygame window? > > Yes, I would very much like some help or general advice now about utilizing this grid thing. How can I refer to these square's new numerical values to do things with them? Will I be using things like "grid[0][1]" in specific functions and methods to refer to squares now? That is what I would like to do, somehow. > > -- > DaveA > -- > http://mail.python.org/**mailman/listinfo/python-list<http://mail.python.org/mailman/listinfo/python-list> > I apologize if these questions are too rudimentary--I am trying to wrap my head around how this language works in a more general sense so I can start applying it to things. -Andrew
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
Re: Question re: objects and square grids Andrew Bradley <abradley201@gmail.com> - 2013-05-15 20:53 -0400 Re: Question re: objects and square grids Larry Hudson <orgnut@yahoo.com> - 2013-05-15 23:54 -0700
csiph-web