[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Loading commands from a file



I'm not sure if this is exactly what you want, but there's an exec command that takes a file object and interprets it as a python script. I think there are also variants that take a file name, and there might also be variants to run the file in a sandbox.

--Mike

Ian Mallett wrote:
Hi,
I'd like to know how to load commands from a file. In the file (in this case a .txt) there would be commands like "glBegin(GL_QUADS)". I would like to load these commands into a program so that the commands can be executed. Previously, I had been selecting all in the .txt file and pasting all in the .py file, but I think there must be a better way. Thanks,
Ian