My Python & co. stuff

Archive for March 2011

Short snippet for settings window as topmost in Pyglet on win32 platform:

    from pyglet.window.win32 import _user32
    from pyglet.window.win32.constants import *

    def set_topmost(window):
        _user32.SetWindowPos(
            window._hwnd, HWND_TOPMOST, 0, 0, 0, 0,
            SWP_NOMOVE | SWP_NOSIZE)

… and settings.py, and urls.py, and so on. Customize as you like.

 

from django.conf import settings
from django.core import management

MY_APP = '' # Your app name here
if not MY_APP_NAME:
    import sys
    MY_APP_NAME = sys.argv[1]

settings.configure(
    DEBUG=True, 
    TEMPLATE_DEBUG=True,
    INSTALLED_APPS = [MY_APP],
    DATABASES = {
        'default': {
            'ENGINE':'django.db.backends.sqlite3',
            'NAME': ':memory:',
            }
        }
    )

management.call_command('test', MY_APP)