Re: [Tutor] postgreSQL + psycopg2

2016-05-09 Thread nitin chandra
Thanks Alan, Peter but didn't work nextrow=(cursor1.execute(query, (design1,))).fetchone() AttributeError: 'NoneType' object has no attribute 'fetchone' 1. Yes Alan, the variable 'design1' has a value '1'. This is how I tested it from python command : >>> import psycopg2 >>> import datetim

Re: [Tutor] is there a better way to do this?

2016-05-09 Thread Steven D'Aprano
On Mon, May 09, 2016 at 06:13:32PM +1000, Chris Roy-Smith wrote: > data = [[" " for x in range(9)] for y in range(count)] > for (ddate, mood, walk, lag, sleep) in curs: > data[row][0]=ddate > data[row][1]=mood > data[row][2]=walk > data[row][3]=lag > data[ro

Re: [Tutor] postgreSQL + psycopg2

2016-05-09 Thread Alan Gauld via Tutor
On 09/05/16 22:14, nitin chandra wrote: > for line1 in smallLIST1: > design1 = line1[3] > print design1 > nextRow=cursor1.execute("SELECT designation_name FROM designation > WHERE designation_id = %s;", (design1)) > print nextRow > print "" > for row in line1: >

Re: [Tutor] is there a better way to do this?

2016-05-09 Thread Joel Goldstick
On Mon, May 9, 2016 at 6:49 PM, Alan Gauld via Tutor wrote: > On 09/05/16 22:03, Ondřej Rusek wrote: > >> but for 'tuples in list'... simple: >> >> data = [] >> for record in curs: >>data += [record] > > Couldn't that be abbreviated to: > > date = list(curs) > I thought I nailed it earlier (an

Re: [Tutor] is there a better way to do this?

2016-05-09 Thread Alan Gauld via Tutor
On 09/05/16 22:03, Ondřej Rusek wrote: > but for 'tuples in list'... simple: > > data = [] > for record in curs: >data += [record] Couldn't that be abbreviated to: date = list(curs) -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/al

Re: [Tutor] postgreSQL + psycopg2

2016-05-09 Thread Peter Otten
nitin chandra wrote: > Hi All, > > I am trying to pass a variable to the following statement : > > for line1 in smallLIST1: > design1 = line1[3] > print design1 > nextRow=cursor1.execute("SELECT designation_name FROM designation > WHERE designation_id = %s;", (design1)) Note that in

Re: [Tutor] is there a better way to do this?

2016-05-09 Thread Ondřej Rusek
Dne 9.5.2016 v 10:13 Chris Roy-Smith napsal(a): Hi Python 3.4 Linux (ubuntu) This code does what I want. curs is the result of a mysql query data = [[" " for x in range(9)] for y in range(count)] for (ddate, mood, walk, lag, sleep) in curs: data[row][0]=ddate data[row][1]=mood

[Tutor] postgreSQL + psycopg2

2016-05-09 Thread nitin chandra
Hi All, I am trying to pass a variable to the following statement : for line1 in smallLIST1: design1 = line1[3] print design1 nextRow=cursor1.execute("SELECT designation_name FROM designation WHERE designation_id = %s;", (design1)) print nextRow print "" for row in lin

Re: [Tutor] How to make object disappear?

2016-05-09 Thread Lisa Hasler Waters
Thank you all so much for your guidance! We will try these out during our next class and will hopefully find success. We can't thank you enough for your support! Best, Lisa and students On Mon, May 9, 2016 at 12:34 PM, Alan Gauld via Tutor wrote: > On 09/05/16 16:55, boB Stepp wrote: > > >> cla

Re: [Tutor] How to make object disappear?

2016-05-09 Thread boB Stepp
On Mon, May 9, 2016 at 11:34 AM, Alan Gauld via Tutor wrote: > On 09/05/16 16:55, boB Stepp wrote: Did not! Lisa Hasler Waters (and her students?) wrote the code!! [Snipped her code and Alan's comments.] boB ___ Tutor maillist - Tutor@python.org To

Re: [Tutor] is there a better way to do this?

2016-05-09 Thread Peter Otten
Chris Roy-Smith wrote: > Hi > Python 3.4 Linux (ubuntu) > > This code does what I want. > curs is the result of a mysql query > > > data = [[" " for x in range(9)] for y in range(count)] > for (ddate, mood, walk, lag, sleep) in curs: > data[row][0]=ddate > data[row][1]=mood >

Re: [Tutor] is there a better way to do this?

2016-05-09 Thread Joel Goldstick
On Mon, May 9, 2016 at 4:13 AM, Chris Roy-Smith wrote: > Hi > Python 3.4 Linux (ubuntu) > > This code does what I want. > curs is the result of a mysql query > > does this work (untested)? data = [] for stuff in curs: data.append(stuff) > > While I don't know a better way to do this, i

Re: [Tutor] How to make object disappear?

2016-05-09 Thread Alan Gauld via Tutor
On 09/05/16 16:55, boB Stepp wrote: >> class dot: >> def __init__(self, canvas, color): >> self.canvas = canvas >> self.id = canvas.create_oval(15, 15, 30, 30, fill='Blue', >> tags='dot1') >> >> this = dot(canvas, 'blue') You create an inst

Re: [Tutor] How to make object disappear?

2016-05-09 Thread Peter Otten
Lisa Hasler Waters wrote: > My students and I are creating a maze game in tkinter. We are trying to > make the ball disappear when it hits the wall (black lines). We are not > having much luck. The following code has run the best, but still, the ball > does not disappear. Any advice would be appre

[Tutor] is there a better way to do this?

2016-05-09 Thread Chris Roy-Smith
Hi Python 3.4 Linux (ubuntu) This code does what I want. curs is the result of a mysql query data = [[" " for x in range(9)] for y in range(count)] for (ddate, mood, walk, lag, sleep) in curs: data[row][0]=ddate data[row][1]=mood data[row][2]=walk data[row][3]=la

Re: [Tutor] How to make object disappear?

2016-05-09 Thread boB Stepp
Hello! I am not one of the experts; instead, I am one of the learners. But if you are seeking assistance on Tutor, it is necessary to post the actual code that you successfully or unsuccessfully ran. If you were unsuccessful, you need to copy and paste the full text of the error messages you rec

Re: [Tutor] How to make object disappear?

2016-05-09 Thread Bob Gailer
On May 9, 2016 8:01 AM, "Lisa Hasler Waters" wrote: > > Dear Tutor, > > My students and I are creating a maze game in tkinter. We are trying to > make the ball disappear when it hits the wall (black lines). We are not > having much luck. The following code has run the best, but still, the ball > d

[Tutor] How to make object disappear?

2016-05-09 Thread Lisa Hasler Waters
Dear Tutor, My students and I are creating a maze game in tkinter. We are trying to make the ball disappear when it hits the wall (black lines). We are not having much luck. The following code has run the best, but still, the ball does not disappear. Any advice would be appreciated! from tkinter