Popular recipes tagged "meta:requires=__main__"http://code.activestate.com/recipes/tags/meta:requires=__main__/2014-12-17T19:03:15-08:00ActiveState Code RecipesClear Only Project Modules (Python)
2014-12-17T19:03:15-08:00Cornelius Jatniel Prinsloohttp://code.activestate.com/recipes/users/4191358/http://code.activestate.com/recipes/578982-clear-only-project-modules/
<p style="color: grey">
Python
recipe 578982
by <a href="/recipes/users/4191358/">Cornelius Jatniel Prinsloo</a>
(<a href="/recipes/tags/clear/">clear</a>, <a href="/recipes/tags/modules/">modules</a>, <a href="/recipes/tags/project/">project</a>, <a href="/recipes/tags/reload/">reload</a>, <a href="/recipes/tags/script/">script</a>, <a href="/recipes/tags/startup/">startup</a>).
</p>
<p>Useful for python sessions that have a long startup time
because of external dependancies
[In my case that would be pygame and pymunk]
I've got a slow computer so it takes a while to startup
this is the solution I came up with</p>
<p>import this before any other of your project imports
example:
import reloading # The modules in your project folder get cleared
then load the rest of your project modules</p>
<p>make sure that the reloading script is in your project folder, or else it won't work</p>
<p>You might be able to extend this by changing line</p>
Completer with history viewer support and more features (Python)
2006-06-29T01:22:23-07:00Sunjoong LEEhttp://code.activestate.com/recipes/users/2925478/http://code.activestate.com/recipes/496822-completer-with-history-viewer-support-and-more-fea/
<p style="color: grey">
Python
recipe 496822
by <a href="/recipes/users/2925478/">Sunjoong LEE</a>
.
Revision 10.
</p>
<p>This module let "tab" key can indent and completing valid python identifiers, keywords, and filenames.
This module support history view also.</p>
<p>Note1: original python rlcompleter module only avail in unix-like environment
Note2: if you seek a more simple completer you could try Jian Ding Chen's recipe at: <a href="http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/496812" rel="nofollow">http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/496812</a></p>
SuperGlobal, access global values from every module (Python)
2005-11-27T10:51:09-08:00Dirk Holtwickhttp://code.activestate.com/recipes/users/636691/http://code.activestate.com/recipes/457667-superglobal-access-global-values-from-every-module/
<p style="color: grey">
Python
recipe 457667
by <a href="/recipes/users/636691/">Dirk Holtwick</a>
(<a href="/recipes/tags/sysadmin/">sysadmin</a>).
</p>
<p>Sometimes you like to have a very global namespace where to put e.g. configuration data. This data should be accessible form all modules you use. SuperGlobal solves this need.</p>
PackagePath (Python)
2005-01-19T18:40:54-08:00Shannon -jj Behrenshttp://code.activestate.com/recipes/users/2269827/http://code.activestate.com/recipes/363781-packagepath/
<p style="color: grey">
Python
recipe 363781
by <a href="/recipes/users/2269827/">Shannon -jj Behrens</a>
(<a href="/recipes/tags/oop/">oop</a>).
Revision 2.
</p>
<p>If you have a hierarchy of packages in a library, permit the user
of your library to have his own hierarchy of packages that "overlays" yours.
That means he can even have classes named the same as your classes, and have
his classes "shadow" yours. It also means that a project can be broken up into
several top-level directories, all of which have the same package hierarchy
within.</p>
Building GTK GUIs interactively (Python)
2001-09-27T15:49:21-07:00Brian McErleanhttp://code.activestate.com/recipes/users/111980/http://code.activestate.com/recipes/65109-building-gtk-guis-interactively/
<p style="color: grey">
Python
recipe 65109
by <a href="/recipes/users/111980/">Brian McErlean</a>
(<a href="/recipes/tags/ui/">ui</a>).
Revision 3.
</p>
<p>One of pythons greatest strengths is the ability to try things interactively at the interpreter.
Using Tkinter shares this strength, since one can create buttons, windows and other widgets,
and instantly see them onscreen, click on buttons to activate callbacks and still be able to
edit and add to the widgets from the python command line.</p>
<p>While the python GTK bindings are generally excellent, one of their flaws is that this is not possible.
Before anything is actually displayed, the gtk.mainloop() function must be called, ending the
possibility of interactive manipulation.</p>
<p>This recipe is a program which simulates a python interpreter which transparently allows the user to
use gtk widgets without having to call mainloop(), in much the same way as Tk widgets.</p>
<p>This latest version contains enhancements added by Christian Robottom Reis to add readline completion support.</p>