Re: Question:Programming a game grid ...

2012-06-27 Thread Steven D'Aprano
On Wed, 27 Jun 2012 19:15:54 -0700, woooee wrote: > "as vars() has not been declared and it does not appear to be valid > Python syntax" > > You assume too much IMHO. Vars() was not declared in the code provided > and I do not think that we should be assuming that it is a function > returning a

Re: Question:Programming a game grid ...

2012-06-27 Thread Rick Johnson
On Jun 27, 5:21 pm, iconoclast011 wrote: > Fairly new to Python ... Is there a way to efficiently (different from my > brute > force code shown below) to set up a game grid of buttons (ie with pygame) > responding to mouse clicks ?   I would want to vary the size of the grid ... > > Thanks > > Br

Re: Question:Programming a game grid ...

2012-06-27 Thread Temia Eszteri
On Wed, 27 Jun 2012 19:43:07 -0700 (PDT), alex23 wrote: >There are two ways to help people: by trying to understand what >they're doing, or by submitting them to endless pedantry. Only one of >those is actually helpful. Is it alright if I use that as a quote? Properly attributed, of course. --

Re: Question:Programming a game grid ...

2012-06-27 Thread iconoclast011
In reply to "alex23" who wrote the following: > On Jun 28, 12:15=A0pm, woo...@gmail.com wrote: > > You assume too much IMHO. =A0Vars() was not declared in > > the code provided and I do not think that we should be > > assuming that it is a function returning a dictionary instead > > of an error. >

Re: Question:Programming a game grid ...

2012-06-27 Thread alex23
On Jun 28, 12:15 pm, woo...@gmail.com wrote: > You assume too much IMHO.  Vars() was not declared in > the code provided and I do not think that we should be > assuming that it is a function returning a dictionary instead > of an error. http://docs.python.org/library/functions.html#vars Do you ha

Re: Question:Programming a game grid ...

2012-06-27 Thread woooee
On Wednesday, June 27, 2012 5:15:09 PM UTC-7, Steven D'Aprano wrote: > On Wed, 27 Jun 2012 16:24:30 -0700, David wrote: > > > First, you should be getting an error on > > vars()[var] = Button(f3, text = "00", bg = "white") > > as vars() has not been declared > > The Fine Manual says differently:

Re: Question:Programming a game grid ...

2012-06-27 Thread alex23
On Jun 28, 8:21 am, iconoclast011 wrote: > Fairly new to Python ... Is there a way to efficiently (different from my > brute > force code shown below) to set up a game grid of buttons (ie with pygame) > responding to mouse clicks ?   I would want to vary the size of the grid ... It hasn't been u

Re: Question:Programming a game grid ...

2012-06-27 Thread Steven D'Aprano
On Wed, 27 Jun 2012 16:24:30 -0700, David wrote: > First, you should be getting an error on > vars()[var] = Button(f3, text = "00", bg = "white") > as vars() has not been declared The Fine Manual says differently: Python 2: http://docs.python.org/library/functions.html#vars Python 3: http://do

Re: Question:Programming a game grid ...

2012-06-27 Thread MRAB
On 27/06/2012 23:21, iconoclast011 wrote: Fairly new to Python ... Is there a way to efficiently (different from my brute force code shown below) to set up a game grid of buttons (ie with pygame) responding to mouse clicks ? I would want to vary the size of the grid ... [code snipped] Someth

Re: Question:Programming a game grid ...

2012-06-27 Thread Chris Angelico
On Thu, Jun 28, 2012 at 9:35 AM, Chris Angelico wrote: > On Thu, Jun 28, 2012 at 9:24 AM, David wrote: >> First, you should be getting an error on >> vars()[var] = Button(f3, text = "00", bg = "white") >> as vars() has not been declared and it does not appear to be valid Python >> syntax. > > It

Re: Question:Programming a game grid ...

2012-06-27 Thread Chris Angelico
On Thu, Jun 28, 2012 at 9:24 AM, David wrote: > First, you should be getting an error on > vars()[var] = Button(f3, text = "00", bg = "white") > as vars() has not been declared and it does not appear to be valid Python > syntax. It's valid syntax, but highly inadvisable. What it does is call the

Re: Question:Programming a game grid ...

2012-06-27 Thread David
First, you should be getting an error on vars()[var] = Button(f3, text = "00", bg = "white") as vars() has not been declared and it does not appear to be valid Python syntax. I don't see a reason to store a reference to the button since you won't be modifying them. Also, you can not mix pack()

Question:Programming a game grid ...

2012-06-27 Thread iconoclast011
Fairly new to Python ... Is there a way to efficiently (different from my brute force code shown below) to set up a game grid of buttons (ie with pygame) responding to mouse clicks ? I would want to vary the size of the grid ... Thanks Brute force code: from Tkinter import * root = T