[Tutor] variable name based on variables (expansion?)

2005-02-28 Thread John Christian
a python 2.3 noob asks: # I have some lists GameLogic.varList0=[1,1,1,1] GameLogic.varList1=[1,1,1,1] GameLogic.varList3=[1,1,1,1] # I want to change specific list elements GameLogic.varList0[2]=0 print GameLogic.varList0 [1,1,0,1] # But I want the assignment # to be based on variables LIST=1 PO

Re: [Tutor] variable name based on variables (expansion?)

2005-02-28 Thread Martin Walsh
John Christian wrote: # But I want the assignment # to be based on variables LIST=1 POSITION=2 GameLogic.varList$LIST[$POSITION]=0 >>> help(getattr) Help on built-in function getattr: getattr(...) getattr(object, name[, default]) -> value Get a named attribute from an object; getattr(x, 'y

Re: [Tutor] variable name based on variables (expansion?)

2005-02-28 Thread Bill Mill
John, On Mon, 28 Feb 2005 06:05:44 -0800 (PST), John Christian <[EMAIL PROTECTED]> wrote: > a python 2.3 noob asks: > > # I have some lists > GameLogic.varList0=[1,1,1,1] > GameLogic.varList1=[1,1,1,1] > GameLogic.varList3=[1,1,1,1] > > # I want to change specific list elements > GameLogic.varLi

Re: [Tutor] puzzling traceback -- what to do with it?

2005-02-28 Thread Bill Mill
On Mon, 28 Feb 2005 02:02:22 -0500, Brian van den Broek <[EMAIL PROTECTED]> wrote: > Hi all, > > I just ran a program of mine and got the traceback: > > >>> > Traceback (most recent call last): >File "C:\PYTHON24\lib\idlelib\rpc.py", line 233, in asyncqueue > self.putmessage((seq, reques

RE: [Tutor] sys.argv[1: ] help

2005-02-28 Thread Smith, Jeff
Richard, I have no problems running your example. It would be helpful in the future ot let us know which version and variant of Python you are running. I am using the canonical (as oppose to ActiveState) Python 2.4. >From the command prompt, type assoc .py and you should see .py=Python.File

RE: [Tutor] gensuitemodule?

2005-02-28 Thread Smith, Jeff
http://www.python.org/doc/2.3.5/mac/module-gensuitemodule.html -Original Message- From: Mike Hall [mailto:[EMAIL PROTECTED] Sent: Friday, February 25, 2005 7:19 PM To: tutor@python.org Subject: [Tutor] gensuitemodule? I'm seeing it used in a Python/Applescript tutorial, though am unclea

Re: [Tutor] sys.argv[1: ] help

2005-02-28 Thread Richard gelling
Hi, Thanks a lot to everyone that replied. I was missing the %* in the following line, in the File associations I just had upto the "%1". Adding %* cured my problem. Python.File="C:\Python24\python.exe" "%1" %* Sorry for the typos in some of my examples, every keyboard I've tried appears to hav

[Tutor] Edonkey Automatic Search Program?!

2005-02-28 Thread . ,
Hi, I just want to know whether this program can be programmed by python or not. p2p program like edonkey is very very complicated (I think so..) but, is searching program for edonkey complicated too? Should the search program be connected to edonkey? (I think so..) The Edonkey Automatic Search Pro

[Tutor] Python and a web image map

2005-02-28 Thread Ertl, John
All, I have been doing Python for a bit now but I am trying to make a clickable map of the world on a web page that gives me the latitude and longitude of a location selected. I have done little with HTML beyond forms and have done no Java script. Is this a problem Python can solve or is this

Re: [Tutor] Edonkey Automatic Search Program?!

2005-02-28 Thread Liam Clarke
You sure could write a client for the eDonkey p2p protocol using Python, the original BitTorrent protocol and client was written in Python. You can download the source somewhere on www.bittorrent.org. But yeah, good luck with that. Regards, Liam Clarke On Mon, 28 Feb 2005 19:48:00 +, . ,

Re: [Tutor] variable name based on variables (expansion?)

2005-02-28 Thread Alan Gauld
> # I have some lists > GameLogic.varList0=[1,1,1,1] > GameLogic.varList1=[1,1,1,1] > GameLogic.varList3=[1,1,1,1] Pythonically: GameLogic.varLists = [[1,1,1,1], [1,1,1,1], [1,1,1,1]] > # But I want the assignment > # to be based on variables > LIST=1

Re: [Tutor] sys.argv[1: ] help

2005-02-28 Thread Alan Gauld
> As an added bonus, you can also create a system environment variable > called PATHEXT and set it to .py and you won't even have to type the .py Well, well, well, you live and learn! :-) Thanks for that neat tip. Alan G. ___ Tutor maillist - Tutor@

Re: [Tutor] Python and a web image map

2005-02-28 Thread Liam Clarke
I would say it's best done as a Javascript thing. function goFunc(e){ x = e.clientX y = e.clientY alert("X=" + x + " Y=" + y) } window.onload = function(e){document.onclick = goFunc;}; Javascript or Python? Save the above as an HTM and click, it should give you the x,y co-ords for the

RE: [Tutor] Python and a web image map

2005-02-28 Thread Ertl, John
Liam, Thanks for the code chunk and the advice. Java script here I come. John Ertl -Original Message- From: Liam Clarke [mailto:[EMAIL PROTECTED] Sent: Monday, February 28, 2005 13:27 To: Tutor Tutor Subject: Re: [Tutor] Python and a web image map I would say it's best done as a Javas

[Tutor] (no subject)

2005-02-28 Thread Lee Harr
I attempting to control xfmedia, http://spuriousinterrupt.org/projects/xfmedia/ , via it's remote from python and I can not get a connection. s = socket.fromfd('/tmp/xfmedia_remote.1001.0', socket.AF_UNIX, socket.SOCK_STREAM) i get this error ", line 1, in ? f = open('/tmp/xfmedia_remote.1001.0')

[Tutor] printing out a box of O's

2005-02-28 Thread Kevin
I just started getting in to python and for taking a look at the for loop. I want to print out a box of O's 10o chars long by 10 lines long this is what I came up with. Is there a better way to do this: j = 'O' for i in j*10: print i * 100 Thanks Kevin ___

Re: [Tutor] printing out a box of O's

2005-02-28 Thread Liam Clarke
for y in range(10): for x in range(10): print "O", print '\n' Or - for y in range(10): print "O"*10 On Mon, 28 Feb 2005 18:35:08 -0600, Kevin <[EMAIL PROTECTED]> wrote: > I just started getting in to python and for taking a look at the for > loop. I want to print

Re: [Tutor] Python and a web image map

2005-02-28 Thread Danny Yoo
> Save the above as an HTM and click, it should give you the x,y co-ords > for the browser window excluding scrolbars etc. It is possible to do this with Python, since a server-side HTML ISMAP will send its coordinates off as part of the request. There are some notes here: http://www.algon

[Tutor] Criticism / Suggestions

2005-02-28 Thread Bill Kranec
Hello, So I think that I've 'completed' my first real Python program, and I would appreciate any constructive criticism you all could offer. The program deals with a question that my Dad asked me awhile ago, which was "If twelve people want to divide into teams of two and play (golf) against e

[Tutor] How to read unicode strings from a binary file and display them as plain ascii?

2005-02-28 Thread R. Alan Monroe
I started writing a program to parse the headers of truetype fonts to examine their family info. But I can't manage to print out the strings without the zero bytes in between each character (they display as a black block labeled 'NUL' in Scite's output pane) I tried: stuff = f.read(nlength)

[Tutor] Re: Edonkey Automatic Search Program?!

2005-02-28 Thread Javier Ruere
. , wrote: Hi, I just want to know whether this program can be programmed by python or not. p2p program like edonkey is very very complicated (I think so..) but, is searching program for edonkey complicated too? Should the search program be connected to edonkey? (I think so..) The Edonkey Automat

[Tutor] Re: How to read unicode strings from a binary file and display them as plain ascii?

2005-02-28 Thread Javier Ruere
R. Alan Monroe wrote: I started writing a program to parse the headers of truetype fonts to examine their family info. But I can't manage to print out the strings without the zero bytes in between each character (they display as a black block labeled 'NUL' in Scite's output pane) I tried: stuf

Re: [Tutor] Python and a web image map

2005-02-28 Thread Alan Gauld
> I have been doing Python for a bit now but I am trying to make a clickable > map of the world on a web page that gives me the latitude and longitude of a > location selected. I have done little with HTML beyond forms and have done > no Java script. Is this a problem Python can solve or is this

Re: [Tutor] printing out a box of O's

2005-02-28 Thread Alan Gauld
- Original Message - From: "Kevin" <[EMAIL PROTECTED]> To: Sent: Tuesday, March 01, 2005 12:35 AM Subject: [Tutor] printing out a box of O's > there a better way to do > this: > > j = 'O' > for i in j*10: > print i * 100 Its not bad, but the for loop could be 'simplified' to: for i in