Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Locked thread
lilbean
Oct 2, 2003

deimos posted:

Nah, I am more thinking for settings and class loading. Like storing the name of the class you're supposed to use for a certain task on a settings file as a string then loading the correct class. Right now I use an eval and I really don't like it.
I've been trying to find this too (basically the equivalent of a lot of the Java reflection API).

Adbot
ADBOT LOVES YOU

lilbean
Oct 2, 2003

Is there any decent page or book outlining how to organize a growing Python project? Right now I've got a src, docs, data and build directory off of the root of my project. In src I've got the base .py files, with a sub-folders named things like gui and so forth. In Java, I'm used to things in the same package not having to be imported. With this project there's a GUI framework that's getting fairly large so at the top of one type of window there'll be this import:
code:
from GUI.TabbedWindow import TabbedWindow
Now I don't know if that's specifically bad, but is explicitly importing everything needed the best way to do it? I can always "import *" but that really doesn't buy me much since one .py file contains one class.

So yeah, nothing is inherently broken with the project as it stands, it's just that I'm not sure of the sort of "standard layout" of Python programs.

lilbean
Oct 2, 2003

agscala posted:

Quick stupid question for a beginner:
If I made some project (lets say... some roguelike game) in python, would I need to have python installed on every machine to play it? Is there a way to avoid that?
You can use py2exe (http://www.py2exe.org/) to make a self-contained executable for Windows platforms.

lilbean
Oct 2, 2003

SlightlyMadman posted:

If pygame or pyglet was used, would they need to be installed as well, or would the exe contain everything needed?
It bundles all the dependencies (at least when I tried it with Pygame it did).

  • Locked thread