Showing posts with label pyglet. Show all posts
Showing posts with label pyglet. Show all posts

14/07/2008

Samurai-X

Finally Ive done it and written a window manager in pure python, lots and lots of ctypes, but no actual c code. Presenting Samurai-X

The feature set is pretty small at the moment, just window resizing/moving, virtual desktops and a statusbar (drawn with cairo). Not sure exactly what the full feature list will look like, probably something like awesome/fluxbox - but with more python goodness

13/04/2008

windoh

Another day another project... >_< well i got to thinking i'd really to have something like Ant Tweak Bar but pure python which led on to thinking of a quick and simple UI library for pyglet... which led onto a not so simple UI library for pyglet... :)

windoh uses pyglets event.EventDispatcher class heavily to make a reasonably nice widget system. It includes a resizeable/draggable frame class and fully inheritable style support. There is also a button and a label class at the moment, I expect there will be more as time goes on.

I need to work out whats going on with pyglets batches a bit better but otherwise it all seems to work pretty ok.

Ive also checked how pylons is doing the --with- stuff so ill be adding pymunk, windoh and maybe atb-ctypes to --with- options to pyglons soon.

The source is in the pyglons repository and there is a very basic page at the pyglons wiki.

True to form there is absolutely zero documentation at the moment, you can check the test.py file, other wise may the source be with you...

12/04/2008

11/04/2008

Ant Tweak Bar ctypes module

For every 3d project iv made with python ive always written a way to use Ant Tweak Bar so I thought for historical reasons I should again for use with pyglet ( and pyglons ). So..

atb-ctypes is a ctypes wrapper around Ant Tweak Bar. It includes a pyglet event handler that can easily be pushed onto the event stack. It is of course perfectly possible to use atb-ctypes with any other windowing/event library, it does not depend on pyglet.

A very minimal sample:

import pyglet
from pyglet.gl import *

import atb
from atb.pyglet_handler import ATBEventHandler

window = pyglet.window.Window()

@window.event
def on_close():
    pyglet.app.exit()

atbhandler = ATBEventHandler(window)

if __name__ == '__main__':
    atb.init()

    for x in range(2):
        bar = atb.Bar('my bar %d' % x)
        myVar = c_float()
        COLOR4F = c_float * 4
        myColor = COLOR4F()
        bar.add_var("some float", myVar)
        bar.add_var("some color", myColor)

    def say_hello(*args):
        print args, "hello"

    bar = atb.Bar('buttons')
    bar.add_button("my button", say_hello)

    pyglet.app.run()

The code is in the pyglons googlecode repo now.

Now I have to go socialize... Its friday!! :]