Re: [Tutor] Variables (with lists??)

2011-11-22 Thread delegbede
Hi Chris, Straight to the point, this is how to populate a python dictionary. customer = {} This statement makes a new dictionary, which is empty though, called customer. A python dictionary has a pair of key and value linked with semicolon and seperated from other pairs by a comma. print

Re: [Tutor] Variables (with lists??)

2011-11-22 Thread Andreas Perstinger
On 2011-11-23 05:15, Chris Kavanagh wrote: I was going over one of Derek Banas' tutorials on youtube, and came across something I hadn't seen before. A variable with a list beside it (see code below). He sets the variable, customer , equal to a dict. Then uses the variable with ['firstname'],['la

[Tutor] Variables (with lists??)

2011-11-22 Thread Chris Kavanagh
I was going over one of Derek Banas' tutorials on youtube, and came across something I hadn't seen before. A variable with a list beside it (see code below). He sets the variable, customer , equal to a dict. Then uses the variable with ['firstname'],['lastname'], ect. I've never seen this in my

Re: [Tutor] Shortening the code

2011-11-22 Thread Asokan Pichai
On Wed, Nov 23, 2011 at 2:47 AM, Mic wrote: > [LOTS OF STUFF SNIPPED] >>> self.chair1.configure(bg="green") >>> os.remove ("Hamburg_Dortmund20_00") > >> And now you delete that file you created without having >> done anything with it? > > The meaning is that when the button is pressed once,  it ch

Re: [Tutor] Physics Engine

2011-11-22 Thread eire1130
I think python- ogre has a physics engine? Its 3d though Sent from my Verizon Wireless BlackBerry -Original Message- From: Christopher King Sender: tutor-bounces+eire1130=gmail@python.org Date: Tue, 22 Nov 2011 19:22:27 To: python mail list Subject: [Tutor] Physics Engine _

[Tutor] Physics Engine

2011-11-22 Thread Christopher King
Does anyone know a good physics engine that works with livewires, or a good reference on how to build 2-D physic engines (preferably the former.) It needs to work well with rope objects. ___ Tutor maillist - Tutor@python.org To unsubscribe or change sub

Re: [Tutor] Quacks like an object

2011-11-22 Thread Christopher King
> > You want to persist data changes to a file? Thats easy enough. Yes, but I want it built in to the objects built in methods like for example doing *listquacker[3]="This string needs to be updated immediately**."* Should write the new data to a file. It should also work for all data types, not j

Re: [Tutor] File vs. Database (possible off topic)

2011-11-22 Thread Ken G.
On 11/22/2011 08:13 AM, Steven D'Aprano wrote: Ken G. wrote: It occurred to me last week while reviewing the files I made in using Python, it could be somewhat similar to a database. What would be a different between a Python files and Python databases? Granted, the access in creating them a

Re: [Tutor] Shortening the code

2011-11-22 Thread Mic
OK, So I'll guess you want a desktop program that eventually sends commands to an online service? If so thats a lot easier to do with Tkinter... :-) Well, it is enough if the program can run on my desktop. However, there are courses about learning how to make programs like these online, but I

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

[Tutor] basic class loading question

2011-11-22 Thread Cranky Frankie
Dave thank you for your patience. It really is appreciated. In the interest of closing this thread I'm posting the final version that works, and achieves the goal of showing how to represent data both in a list and in an object: # # Example to show the difference between list data and object data

Re: [Tutor] write list of tuples to file (beginner)

2011-11-22 Thread Alan Gauld
On 22/11/11 18:50, Mayo Adams wrote: for item in tuplelist outputfile.write (item) doesn't work, and I suppose I scarcely expect it should, but I am at a loss to find out how to do it. You need to convert the tuple to a string. And you need to add a newline at the end. A simple w

[Tutor] calling modules in different minor versions of Python

2011-11-22 Thread Gregory, Matthew
Hi all, We work with a python package (ESRI geoprocessor) that only releases their packages tied to specific minor version of Python (e.g. 2.5). We are predominantly working with 2.6, but have Python 2.5 installed as well. When we want to call modules that use the geoprocessor package, we are

Re: [Tutor] basic class loading question

2011-11-22 Thread Alan Gauld
On 22/11/11 17:09, Cranky Frankie wrote: Dave I'm sorry but I just don't get this. I have virtually no experience with classes. You need to step back and rethink the terminology a bit. A class is a cookie cutter for creating objects. Objects are instances of the class. What seems like it sh

Re: [Tutor] write list of tuples to file (beginner)

2011-11-22 Thread Hugo Arts
On Tue, Nov 22, 2011 at 7:50 PM, Mayo Adams wrote: > I have a list of tuples of the form (string,integer) that I would like to > write  to  a file with a line break between each. Simply writing to a file > object thus > > for item in tuplelist >    outputfile.write (item) > > doesn't work,

Re: [Tutor] Shortening code.

2011-11-22 Thread Alan Gauld
On 22/11/11 15:11, Mic wrote: > Also, do you really need the colors, you don't actually use them for > anything below except the initial color, but you might as well just hard Button1 is supposed to represent chair one in the train. So call it chair_1 or put it in a list called chairs so th

[Tutor] write list of tuples to file (beginner)

2011-11-22 Thread Mayo Adams
I have a list of tuples of the form (string,integer) that I would like to write to a file with a line break between each. Simply writing to a file object thus for item in tuplelist outputfile.write (item) doesn't work, and I suppose I scarcely expect it should, but I am at a loss to

Re: [Tutor] basic class loading question

2011-11-22 Thread Dave Angel
On 11/22/2011 12:09 PM, Cranky Frankie wrote: On Tue, Nov 22, 2011 at 11:26 AM, Dave Angel wrote: snip quarterbacks = [] for quarterbacks.append( ) Now that you really have a list, then you can print a particular one with: print (quarterbacks[2].last_name) Dave I'm sorry but

Re: [Tutor] basic class loading question

2011-11-22 Thread Cranky Frankie
On Tue, Nov 22, 2011 at 11:26 AM, Dave Angel wrote: snip > quarterbacks = [] > for >     quarterbacks.append(       ) > > > Now that you really have a list, then you can print a particular one with: > > print (quarterbacks[2].last_name) Dave I'm sorry but I just don't get this. I have virtua

Re: [Tutor] basic class loading question

2011-11-22 Thread Dave Angel
On 11/22/2011 09:20 AM, Cranky Frankie wrote: OK, but this is still not working: class Qb: def __init__(self, first_name='', last_name='', phone='', email='', stadium=''): self.first_name = first_name self.last_name = last_name self.phone = phone self.ema

[Tutor] Shortening code.

2011-11-22 Thread Mic
Please change to a sensible subject when replying to digest messages. -Yes, sorry about that. from tkinter import* button1_color="green" button1_value=False button2_color="green" button2_value=False buttonX_value still doesn't say mu

Re: [Tutor] Question on List Comprehensions

2011-11-22 Thread Steve Willoughby
On 21-Nov-11 23:49, Charles Becker wrote: Alan, Steve, future readers, After some re-reading and hacking I was able to discover the solution. Since I raised the question here it is : [['{0}'.format(x+1), x+1] for x in range(size)] Just to fill out some other refinements for your information

Re: [Tutor] basic class loading question

2011-11-22 Thread Cranky Frankie
OK, but this is still not working: class Qb: def __init__(self, first_name='', last_name='', phone='', email='', stadium=''): self.first_name = first_name self.last_name = last_name self.phone = phone self.email = email self.stadium = stadium Qb_list

Re: [Tutor] basic class loading question

2011-11-22 Thread Dave Angel
On 11/22/2011 08:17 AM, Cranky Frankie wrote: I have a basic question about how to load a class. If I have this class: class QB: def __init__(self, first_name='', last_name='', phone='', email='', stadium=''): self.first_name = first_name self.last_name = last_name

Re: [Tutor] File vs. Database (possible off topic)

2011-11-22 Thread Steven D'Aprano
Ken G. wrote: It occurred to me last week while reviewing the files I made in using Python, it could be somewhat similar to a database. What would be a different between a Python files and Python databases? Granted, the access in creating them are different, I really don't see any different

[Tutor] basic class loading question

2011-11-22 Thread Cranky Frankie
I have a basic question about how to load a class. If I have this class: class QB: def __init__(self, first_name='', last_name='', phone='', email='', stadium=''): self.first_name = first_name self.last_name = last_name self.phone = phone self.email = email

Re: [Tutor] Python code trouble!

2011-11-22 Thread Asokan Pichai
Okay! I wrote some code. It is below so that you can avoid scrolling down and seeing it if you do not want to see any code! HTH Asokan people = list(" ABCDEFGHIJKLMN") COUNT = len(people) remove = 3 SPACE = ' ' def survivorCount(a): return len(a) - a.count(