[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [pygame] SGC 0.1.4 Released
On 12-06-10 03:28 AM, René Dudfield wrote:
Great!
I like how you have integrated the GUI events with a normal pygame
event loop: http://program.sambull.org/sgc/tutorial.events.html
For example, a quit button could work like the following:
if e.type == QUIT or (e.type == GUI ande.widget == quit_button):
raise SystemExit()
Could the tutorials be based on examples? Then people can run the
example, and learn that way as well.
I believe one of them is already (the helloworld.py tutorial). Making
all of the tutorials example code does sound like a good idea.
You might want to consider putting the examples in sgc.examples with
relative imports, so they are easier to run. Likewise, consider
adding your unit tests into somewhere like sgc.tests.
Keep in mind, that then the user of the library needs to *delete* them
from the library when they copy the library into their game (or have
extra code and data-files in their project). (Sam moved the examples
*out* at my suggestion, actually). If the examples get beyond a few
trivial files (which I'm hoping they will, as they begin to show how to
use custom images and the like), then that may be a non-trivial size.
Similar issue for the unit tests; if there are enough to be worthwhile
they'll be a non-trivial amount of code, likely with quite a few
data-fixtures.
As for relative imports; I'm not sure I follow the logic there. If sgc
is on the path (either because you ran setup.py install/develop or
because you are in the root source-code directory), then the examples
should all run. If it's not, then a relative import doesn't, AFAIK,
work (that is, from .. import X will just report "Attempted relative
import in a non-package")?
Anyway, just my thoughts,
Mike
--
________________________________________________
Mike C. Fletcher
Designer, VR Plumber, Coder
http://www.vrplumber.com
http://blog.vrplumber.com