Re: [Tutor] Beginner Game: Rock, Paper, Scissors

2007-06-26 Thread Luke Paireepinart
Johnny Jelinek wrote: > how would I go about rendering an .svg to another file before showing > it on screen? Could you point me to some resources or examples? Thanks! You just mentioned that Cairo renders svgs to a file, didn't you? So can you just use pyCairo? Google would tell you of other py

Re: [Tutor] Beginner Game: Rock, Paper, Scissors

2007-06-26 Thread Johnny Jelinek
how would I go about rendering an .svg to another file before showing it on screen? Could you point me to some resources or examples? Thanks! On 6/26/07, Luke Paireepinart <[EMAIL PROTECTED]> wrote: Johnny Jelinek wrote: > sure, I wouldn't mind looking at your code :D! Also, the graphical >

Re: [Tutor] Beginner Game: Rock, Paper, Scissors

2007-06-26 Thread Luke Paireepinart
Johnny Jelinek wrote: > sure, I wouldn't mind looking at your code :D! Also, the graphical > one you sent me was using gif's, do you know how to render svg's on > screen? The advantage to vector rather than raster is that you can > resize it as big as you could ever desire and it will never lo

Re: [Tutor] Importing and creation on the fly

2007-06-26 Thread Tino Dai
On 6/26/07, Dave Kuhlman <[EMAIL PROTECTED]> wrote: On Tue, Jun 26, 2007 at 12:20:18PM -0400, Tino Dai wrote: > Hi there, > > I've been banging my head on this for about two weeks, and I can't > figure out a solution to this. I'm wondering if you could assist me on this > pesky problem. > >

Re: [Tutor] Importing and creation on the fly

2007-06-26 Thread Dave Kuhlman
On Tue, Jun 26, 2007 at 12:20:18PM -0400, Tino Dai wrote: > Hi there, > > I've been banging my head on this for about two weeks, and I can't > figure out a solution to this. I'm wondering if you could assist me on this > pesky problem. > > I'm reading in an xml file that has the name of c

Re: [Tutor] Importing and creation on the fly

2007-06-26 Thread Kent Johnson
Tino Dai wrote: > Hi there, > > I've been banging my head on this for about two weeks, and I can't > figure out a solution to this. I'm wondering if you could assist me on > this pesky problem. > > I'm reading in an xml file that has the name of class, location, > and the filename in

Re: [Tutor] Fastest way to iterate through a file

2007-06-26 Thread Robert Hicks
Kent Johnson wrote: > Robert Hicks wrote: >> Kent Johnson wrote: >>> Robert Hicks wrote: idList only has about 129 id numbers in it. >>> That is quite a few times to be searching each line of the file. Try >>> using a regular expression search instead, like this: >>> >>> import re >>> regex =

Re: [Tutor] using shelve

2007-06-26 Thread Kent Johnson
Reed O'Brien wrote: > Thanks for the heads up, Kent. I didn't realize that was a copy of > Lutz's book. I sent notice to [EMAIL PROTECTED] > It did seem like an awfully rich comparison of python persistence > options. > > If they follow up with me I will follow up with the list. I also emai

Re: [Tutor] Fastest way to iterate through a file

2007-06-26 Thread Kent Johnson
Robert Hicks wrote: > Kent Johnson wrote: >> Robert Hicks wrote: >>> idList only has about 129 id numbers in it. >> That is quite a few times to be searching each line of the file. Try >> using a regular expression search instead, like this: >> >> import re >> regex = re.compile('|'.join(idList))

[Tutor] Importing and creation on the fly

2007-06-26 Thread Tino Dai
Hi there, I've been banging my head on this for about two weeks, and I can't figure out a solution to this. I'm wondering if you could assist me on this pesky problem. I'm reading in an xml file that has the name of class, location, and the filename into a dictionary. I want to import th

Re: [Tutor] Fastest way to iterate through a file

2007-06-26 Thread Robert Hicks
Kent Johnson wrote: > Robert Hicks wrote: >> idList only has about 129 id numbers in it. > > That is quite a few times to be searching each line of the file. Try > using a regular expression search instead, like this: > > import re > regex = re.compile('|'.join(idList)) > for line in f2: >if

Re: [Tutor] Fastest way to iterate through a file

2007-06-26 Thread Jason Massey
Also since you're writing your found results to a file there's no need to print the results to the screen. That should shave off some time, especially if you have a lot of hits. On 6/26/07, Kent Johnson <[EMAIL PROTECTED]> wrote: Robert Hicks wrote: > idList only has about 129 id numbers in it

Re: [Tutor] Fastest way to iterate through a file

2007-06-26 Thread Dave Kuhlman
On Tue, Jun 26, 2007 at 10:04:07AM -0400, Kent Johnson wrote: > Robert Hicks wrote: > > This is the loop code: > > > > for line in f2: > > for id in idList: > > if id in line: > > print "%s: %s" % (id, f2.next()) > > found = "%s: %s" % (id, f2.next()) > >

Re: [Tutor] Fastest way to iterate through a file

2007-06-26 Thread Kent Johnson
Robert Hicks wrote: > idList only has about 129 id numbers in it. That is quite a few times to be searching each line of the file. Try using a regular expression search instead, like this: import re regex = re.compile('|'.join(idList)) for line in f2: if regex.search(line): # process a h

Re: [Tutor] Fastest way to iterate through a file

2007-06-26 Thread Robert Hicks
Kent Johnson wrote: > Robert Hicks wrote: >> This is the loop code: >> >> for line in f2: >> for id in idList: >> if id in line: >> print "%s: %s" % (id, f2.next()) >> found = "%s: %s" % (id, f2.next()) >> f3.write(found) >> >> >> I have an list,

Re: [Tutor] Beginner Game: Rock, Paper, Scissors

2007-06-26 Thread Johnny Jelinek
sure, I wouldn't mind looking at your code :D! Also, the graphical one you sent me was using gif's, do you know how to render svg's on screen? The advantage to vector rather than raster is that you can resize it as big as you could ever desire and it will never lose quality. That means I could

Re: [Tutor] Bundle help!

2007-06-26 Thread Kent Johnson
Sara Johnson wrote: > Hi Kent, > > I had a list to sort alphabetically (that included names and > percentages), then I had to apend that list to sort by the category > represented by the percentages. I've tried to use something like: > > mylist = [whatever...] > mylist.append(whatever) and t

Re: [Tutor] Fastest way to iterate through a file

2007-06-26 Thread Kent Johnson
Robert Hicks wrote: > This is the loop code: > > for line in f2: > for id in idList: > if id in line: > print "%s: %s" % (id, f2.next()) > found = "%s: %s" % (id, f2.next()) > f3.write(found) > > > I have an list, idList[], that contains a lis

Re: [Tutor] Fastest way to iterate through a file

2007-06-26 Thread Robert Hicks
Kent Johnson wrote: > Robert Hicks wrote: >> I have a script at work where I have a list of id numbers and I am doing a: >> >> for line in ehFile: > > That is fine > >> for id in line: > > I don't know what this is for - line is a string, iterating it will give > you every character is the

[Tutor] Beginner Game: Rock, Paper, Scissors

2007-06-26 Thread Johnny Jelinek
Hello, I'm a beginner to python; I wanted to make a fun little game, so I started with something simple: Rock, Paper, Scissors. The program I made satisfies me, but I want to add graphics. I installed pygame, and have some svg's that I want to render into graphics. I installed cairo, but then r

Re: [Tutor] Animating changes with Numpy arrays

2007-06-26 Thread Luke Paireepinart
Andy Cheesman wrote: > Hi people > > Thanks to people's most excellent help with the Automatic generation of > an "all possible combinations" array. I've got a beta version of my > program working. > However, I was wondering if there is an "easy" way to animate changes > between arrays and to show

[Tutor] Animating changes with Numpy arrays

2007-06-26 Thread Andy Cheesman
Hi people Thanks to people's most excellent help with the Automatic generation of an "all possible combinations" array. I've got a beta version of my program working. However, I was wondering if there is an "easy" way to animate changes between arrays and to show the number of the loop which the p