Python Bindings for Haiku

I’ve just today begun working on bindings for python to use Haiku APIs. I managed to create a simple GUI application with a label. Here’s the code:

from BKit import *

class MyApplication(BApplication):
def init(self):
BApplication.init(self, “application/x-vnd.myApp”)
frame = BRect(100, 100, 500, 400)
self.window = BWindow(frame, “My First App”,
frame.Set(10, 10, 11, 11)
label = BStringView(frame, “My Label”, “Python in Haiku Rocks!”);

if name == “main”:
app = MyApplication()

And a screenshot:

This is all it can currently do, but it only took about an hour to setup and add the functionality. As you can see, the programming closely mimics how the same programming would be done in C++. I was wondering if anyone was interested in helping, had any questions, or just wanted to discuss the role of Python in Haiku.

Are making your own bindings from scratch???

They already exist and are quite advanced:
See Donn Cave’s excellent BeThon 0.5.4

Hi xvedejas,

you are aware of one of this year’s Google Summer of Code project (see latest blog post)?