Conway's Life Implementation

2006-08-27 Thread Putty
Hi.  I was going to write an implementation of John Conway's Life game
using Python and Tk, but I soon found that Tk just didn't cut the
mustard for memory usage, management, and the like for such a project,
so I've found my best GUI bet for my project is wxPython and not
pygame.

Anybody have any advice thus far?

Anyway, my real question is if anybody knows of any tutorials or source
code from other implementations and other languages that may prove
useful?

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Conway's Life Implementation

2006-08-27 Thread Putty
Do you think it would be reasonable to use wxGrid to make the game
area?

[EMAIL PROTECTED] wrote:
> Putty wrote:
> > Hi.  I was going to write an implementation of John Conway's Life game
> > using Python and Tk, but I soon found that Tk just didn't cut the
> > mustard for memory usage, management, and the like for such a project,
> > so I've found my best GUI bet for my project is wxPython and not
> > pygame.
> >
> > Anybody have any advice thus far?
> >
> > Anyway, my real question is if anybody knows of any tutorials or source
> > code from other implementations and other languages that may prove
> > useful?
>
> I find that wxPython is very easy to use..  I just noticed a graphic
> library that may or may not help
> http://language-binding.net/pyplusplus/examples/easybmp/easybmp.html
> I am not sure if you can work with pixels with wxPython but you can
> probily do the life game with tiles also..

-- 
http://mail.python.org/mailman/listinfo/python-list


python for flash drives

2006-08-29 Thread Putty
Is there such a thing as a special version of python that I can run
more efficiently from a flash drive?  I'll be at college for hours
every day with hours of free time for the next few months, but the only
computers at my disposal are windows PCs that use GoBack to auto-revert
every reboot.  So I'm kinda stuck.  I don't want to have to reinstall
python AND wxPython AND PIL every stinking time I log on.  However,
using it from my flash drive is painfully slow taking up to a minute
just to execute some scripts.  And it's not doing me any favors with
I/O to the flash disk either.

So I was wondering if anybody knew of some flash drive implementations
of python that might exist out there somewhere?

-- 
http://mail.python.org/mailman/listinfo/python-list


python equivalent for fputc

2006-08-30 Thread Putty
I'm porting a program a friend wrote in C over to Python and I've run
into a little hang-up.  The C program writes characters out to a file.
I'm 99% sure that a conversion is going on here as well.  I know for a
fact that it's taking a number and turning it into a character.

So what kind of call can I make to do it in Python?

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: python equivalent for fputc

2006-08-30 Thread Putty
Thanks, John.  That's exactly what I was looking for!

John Machin wrote:
> Putty wrote:
> > I'm porting a program a friend wrote in C over to Python and I've run
> > into a little hang-up.  The C program writes characters out to a file.
> > I'm 99% sure that a conversion is going on here as well.  I know for a
> > fact that it's taking a number and turning it into a character.
>
> C is a low-level language -- a character *is* a number :-)
>
> >
> > So what kind of call can I make to do it in Python?
>
> *Guessing* that you mean e.g. fputc(97, f) writes the character 'a' to
> the file whose handle is f ...
>
> In Python the more-or-less literal translation (ignoring the fputc
> return value) would be f.write(chr(97))
>
> Note:
> |>>> ord('a')
> 97
> |>>> chr(97)
> 'a'
>
> HTH -- if not, show us (relevant parts of) the actual source that you
> are porting.
> 
> Cheers,
> John

-- 
http://mail.python.org/mailman/listinfo/python-list


python loops

2006-08-31 Thread Putty
In C and C++ and Java, the 'for' statement is a shortcut to make very
concise loops.  In python, 'for' iterates over elements in a sequence.
Is there a way to do this in python that's more concise than 'while'?

C:
for(i=0; ihttp://mail.python.org/mailman/listinfo/python-list


raw audio in windows

2006-08-31 Thread Putty
Hi.  I've written a small python script that was primarily meant for
use in a unix-compatible environment.  It writes a bunch of raw audio
to a file and then sends the file to /dev/audio and the system plays
the audio.  Very simple.

Is there a simple way I could edit the script (which just uses the
system call to do this) to run under windows?

This is the code that would have to change:
os.system("cat audioBuf > /dev/audio")

-- 
http://mail.python.org/mailman/listinfo/python-list