Re: [Tutor] Shorten Code

2011-11-22 Thread Alan Gauld
On 22/11/11 19:41, Mic wrote: A Tkinter program is never going to be an online GUI, it only works on the desktop. For that you need to use HTML5/Flash/Javascript/Java etc. And its all a lot more messy. No, I didn't mean that it have to work online. It is just fine if it works on the desktop.

Re: [Tutor] Shorten Code

2011-11-22 Thread Mic
Button1 is supposed to represent chair one in the train. So call it chair_1 or put it in a list called chairs so that you can access them as chairs[0] or whatever. But get a name that reflects what its actually used for. Yes, perhaps that is a good way to go. I didn't think about that. at

Re: [Tutor] Shorten Code.

2011-11-19 Thread ALAN GAULD
> >> > > for var in [value,value_1]: >> > > var = "green" >> >> > Um, that won't work. You typed that example too quickly. > > >> Excuse: It was early morning and I hadn't had any coffee... > >> In your defense Alan, after you typed that code in your response you >mentioned > the necessity o

Re: [Tutor] Shorten Code.

2011-11-18 Thread Alexander Etter
On Nov 18, 2011, at 13:15, ALAN GAULD wrote: > > > > for var in [value,value_1]: > > >var = "green" > > > > Um, that won't work. You typed that example too quickly. > > Oops! Yes. You'd need to enumerate and access the variables > via an index. yuk. Don't do it folks! :-) > > Excuse: It w

Re: [Tutor] Shorten Code.

2011-11-18 Thread ALAN GAULD
> > for var in [value,value_1]: > >var = "green" > > Um, that won't work. You typed that example too quickly. Oops! Yes. You'd need to enumerate and access the variables via an index. yuk. Don't do it folks! :-) Excuse: It was early morning and I hadn't had any coffee... Alan G.

Re: [Tutor] Shorten Code.

2011-11-18 Thread Dave Angel
On 11/18/2011 04:01 AM, Alan Gauld wrote: On 18/11/11 08:16, Mic wrote: What if I don’t write the same line of code more than once, but I write similiar lines more than once. Is that okay? Ler For example: value="green” value_1=”green” If you had a lot of these you could shorten it with a loo

Re: [Tutor] Shorten Code.

2011-11-18 Thread Alan Gauld
On 18/11/11 08:16, Mic wrote: What if I don’t write the same line of code more than once, but I write similiar lines more than once. Is that okay? Ler For example: value="green” value_1=”green” If you had a lot of these you could shorten it with a loop (BTW the English term in programming ter

[Tutor] Shorten Code.

2011-11-18 Thread Mic
From: Wayne Werner Sent: Thursday, November 17, 2011 8:30 PM To: Mic Cc: tutor@python.org Subject: Re: [Tutor] Clock in tkinter? Say that I have a class and I want to make 100 objects. Then it could look like this: class Chairs(object): #Create the objects chair1=Chair