New attempt to finish the python GUI API (codename KOI)

Hi again,

i had a few personal troubles, that’s why i’ve stopped the API work for a few weeks. But now i’m back writing on the API.

It has a few improvements since the last version:

  • load and render bitmap fonts (are generated from TTF files with the “Bitmap Font Generator”)
  • the API can now also be used without Blender

The API is still not completely done, but some features that might be interessting for others are allready working (bitmap fonts for example).

The UIFontManager module is written to work also with normal blender GUI scripts (so the API is not needed for bitmap fonts to work).

You find the project at: http://code.google.com/p/koi-ui/.
!! Checkout into you custom python script folder !!

Here a short source example for using only the bitmap font rendering (text can be scaled also!):


"""
Test area for the KOI UI.
"""


from koiui.WindowManager import WindowManager

from koiui.UIGL import gl
from koiui.UIDraw import *

from koiui.UIFontManager import UIFontManager



def event(e, v):
    print "<event: ", e, "= ", v, ">"
        


def gui():
    gl.glClearColor(0,0,0,1)
    gl.glClear(gl.GL_COLOR_BUFFER_BIT)
    
    gl.glTranslatef(20, 10, 0)
    #gl.glScalef(4,4,0)
    gl.glColor4f(1,0,0,1)
    
    #test font rendering
    fm.fonts[0].render(0, 0, "KOI-UI, by Steven Truppe")
    
    
    

wm = WindowManager()
wm.setEventConsumer(event)
wm.setRenderCallback(gui)



fm = UIFontManager()
list = fm.Get()
print "Fonts found: ", list
fm.addFont("a750.fnt")

# GO GO GO
wm.Register()

best regards,
Steven Truppe

Your code just produces a console error on my 2.48a.

Telling the exact error would help tremendously. You should’ve learned by now :slight_smile:

/Nathan

Hi,

please post the error message that you get. Maybe you found an error. I’m only able to solve it with the output of the blender console.

btw: have you checkout out the svn repo into your custom python script dir ? Otherwise it’s not working (maybe i change that later).

No module named koi, of course.

On your google download page there is nothing.

As i wrote on the project page and the last post: You have to checkout into you custom python directory (the one you set in the blender settings in “File Paths”, The one for python scripts).

And the project page is at:

http://code.google.com/p/koi-ui/

You also need to checkout the branch !! Not trunk !!! Sorry… i forgot this… (branch is calledkoi-ui-0.2)