Python in Haiku

I’m new to Haiku. I see that python is installed.

Is there a way to create GUI Apps in python for Haiku?

There isn’t any GUI bindings for Python in Haiku yet.
QT and GTK are work in progress that has been done so maybe soon you will be able to make PyQT and PyGTK apps.

Python Be bindings would be awesome.

– See my newer post below.

There is Bethon, but I am not sure if that still works with the current Python in Haiku.

At least the sample Test files work, but Bethon is very difficult to understand and learn for a beginner.

I just bought a good programming Python Book for children and beginner.
Maybe you heard about that book, it’s name is “Hello World”… very nice written… easy to understand…
Unfortunatelly it uses some Librarys (urllib and Tkinter and easygui) which are not supported by Python for Haiku.
The programms in this book dont’ work. “easygui” - Library is realy easy to learn and use, maybe someone can try to port it to Haiku, but I dont think it will work since it uses the Tkinter-Module which is not supported.

If you want to write Haiku programs but C++ gives you convulsions (I understand, really) your choices right now are yab (BASIC) and Squirrrel (LOGO). Both are available at Haikuware.

In fact there is quite an active little yab community at Haikuware at the moment, and with everyone who is qualified to understand the Haiku API and C++ busy hacking away on the OS itself, most of the apps that are coming in there are either written in yab or are ported SDL games.

A working python interface to the Haiku API would be awesome. In fact, even a TCL/TK setup would be appreciated. Just as long as it is well documented!

In the meantime give yab a shot. The days of 100 GOTO 1000 are far behind us.

To answer the original poster - yes there is python Be bindings.

It is called Bethon and it works in Haiku (it has had updates specifically for Haiku). If you are moderately skilled python programmer it shouldn’t be too hard to use and there is some good examples included in the package.

After fixing my website, getting to know Bethon is next on my todo list.

After fixing my website, getting to know Bethon is next on my todo list.

Would be great to get some documentations or a tutorial how to use Bethon.
As I told in my previcious post, Bethon sample files are running, but not easy to understand for a beginner.

Well I have fixed my website (well, not totally but enough that I am not too worried about it) and I recently played with PyQt4 and it which was VERY simple get into. great tutorials to get you going.

Perhaps now that Qt has been ported and works well in Haiku somebody could port PyQt4? - I would like to be involved but my C++ skills are very minimal.

I will look at Bethon again shortly and see how I go. Perhaps I could try to mimic the tutorials I referred to earlier but use Bethon. Would be a great exercise for me personally and the resulting documentation would be very valuable.

i got bethon to work with haiku by modifying some of the makefiles & header files , and actually i am working on an graphical ftp client built with these two technologies, so if you need any pointers here i could help you out.

1 Like

I am pretty sure I didn’t have to do any modification to make Bethon work in Haiku. Just make sure you get an up to date version I guess…

While having Bethon is great for writing native Haiku apps, I still think that having TkInter or whatever widely-used cross-platform GUI toolkit Python coders are using these days would be a good idea since it would allow other people’s Python scripts to run on Haiku…

1 Like

Rene or Daniel,

Would it make sense to publish a simple Bethon / Python app to Haikuware so we can make a public statement about support? And also give people something new to play/test with? This would need a quick write-up so newbies can set it up. Does this run under Alpha R1, or does it need a newer version?


1 Like

Im curious is anybody works on PyQT bindings for haiku’s python?

Heh, I wouldn’t say it gives me convulsions but I certainly do have a hard time motivating myself to program in c++ in my spare time.

I like Python but sadly it’s too slow for certain types of programs, still for programs which rely mainly on native code calls for heavy lifting (like leveraging the Haiku ‘kits’) or aren’t particularly cpu dependant, I think Python is a great choice.

Speaking of languages, I remember seeing talk about Go being ported to Haiku, anyone seen any news about that? It’s a language I’ve been considering playing around with and it would be great to be able to do so using Haiku.

This may be what you are looking for:

These files are the result of a 2011 gsoc project to add haiku gui bindings to pearl and python.

I’m not a giant fan of C++ myself, and I’ve put in a lot of time fooling around with alternatives on BeOS and Haiku. Someday it may turn out to have been time well spent, beyond just my own intellectual curiosity, but today the problem is, the Haiku world is really small. The very small fraction of programmers who program for Haiku, the very small fraction of them who program in Python, the fraction of them who would in theory be happy with a particular toolkit port … pretty soon you’re talking about numbers where it makes a big difference whether you round up or down.

We’re all going to do what we want anyway, and if what you want is to play around with Python on Haiku, that’s fine. Some people are programming language geeks and there’s nothing to be done about it (I know, that’s me.) But if you have an idea that’s been keeping you awake about an application you need to write, or you just want to join the very small crowd of people who are hammering away at useful Haiku work – please get comfortable with C++. The BeOS / Haiku take on C++ is pretty basic and easy to live with, and with some discipline you can write pretty good code in C++. (And you can write awful code in Python - I’ve sure done it, and I’ve seen better men than me do it.)

A post was split to a new topic: Tkinter on Haiku?