Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #45385

Re: Question re: objects and square grids

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.mixmin.net!hq-usenetpeers.eweka.nl!81.171.88.250.MISMATCH!newsfeed.eweka.nl!eweka.nl!feeder3.eweka.nl!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <abradley201@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'parameters': 0.04; 'column': 0.07; 'friend.': 0.07; 'list?': 0.07; 'squares': 0.07; 'subject:Question': 0.07; 'correct,': 0.09; 'grid': 0.09; 'learn,': 0.09; 'rows': 0.09; 'utilizing': 0.09; 'window?': 0.09; 'runs': 0.10; 'cc:addr:python-list': 0.11; 'coordinates': 0.16; 'pygame': 0.16; 'somehow.': 0.16; '\xa0print': 0.16; 'do,': 0.16; 'language': 0.16; 'trying': 0.19; 'numerical': 0.19; 'things.': 0.19; '>>>': 0.22; 'appears': 0.22; 'cc:addr:python.org': 0.22; 'print': 0.22; 'now?': 0.24; 'rid': 0.24; 'skip:\xa0 20': 0.24; 'sorry,': 0.24; 'question': 0.24; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; 'values': 0.27; 'header:In-Reply-To:1': 0.27; 'message-id:@mail.gmail.com': 0.30; 'url:mailman': 0.30; 'code': 0.31; 'that.': 0.31; 'them?': 0.31; 'week.': 0.33; 'worked': 0.33; 'url:python': 0.33; 'minimal': 0.33; 'sense': 0.34; "i'd": 0.34; "can't": 0.35; 'advice': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'really': 0.36; 'much.': 0.36; 'right?': 0.36; 'url:listinfo': 0.36; 'doing': 0.36; 'url:org': 0.36; 'too': 0.37; 'being': 0.38; 'thank': 0.38; '8bit%:4': 0.38; 'question,': 0.38; 'skip:& 20': 0.39; 'url:mail': 0.40; 'how': 0.40; 'color': 0.61; 'utilize': 0.61; 'new': 0.61; 'entire': 0.61; 'show': 0.63; 'refer': 0.63; 'more': 0.64; '(that': 0.65; 'applying': 0.72; 'gotten': 0.74
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=AMxTqbn+vhdSzUpKyqIbz57R6PJcN6VFuiNqQ/qjwxA=; b=q1hzFoutaDZ8AP8dP/fv44s3RazMoeWeN4l6PevI6OEav6r/fQHP9Lm844JppejuOP yLkhrZS+mhE3ta8Wb8K76CllZ3NSiYCUEb/jX5slpdvjlNqj/COtU6Hvw6yJrNDL9RZH xOu2WWhKnJpj4yJlY8ElF6CgymFeZaRbtLLQW8pJ1kZJVxIarxL312d0+p47aU6HUYsn 7J4g0cF4OAISnnS3WoDgwz3eRX686qaAo8J1LpUWkYz6Z39sQiXJSI9+l7ytQIWapALz 06LfqLcNXicrmZJjHtEVPKJ416TDdP/x/qrGlssNSupp7wWFzkWR2AaxQididPHEIrXd zFNA==
MIME-Version 1.0
X-Received by 10.50.85.12 with SMTP id d12mr7221540igz.91.1368665585997; Wed, 15 May 2013 17:53:05 -0700 (PDT)
In-Reply-To <519425AC.3070605@davea.name>
References <CAPp_YbVwiK1RBk_fLP32Kzv56GjYUf4TL=Ogzo5qsOKtrd8kGg@mail.gmail.com> <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 Wed, 15 May 2013 20:53:05 -0400
Subject Re: Question re: objects and square grids
From Andrew Bradley <abradley201@gmail.com>
To Dave Angel <davea@davea.name>
Content-Type multipart/alternative; boundary=089e013cb87011de4604dccb4aca
Cc python-list@python.org
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.1727.1368665595.3114.python-list@python.org> (permalink)
Lines 136
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1368665595 news.xs4all.nl 15957 [2001:888:2000:d::a6]:38805
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:45385

Show key headers only | View raw


[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 | NextNext in thread | Find similar | Unroll thread


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