Building a Python app with Mozilla

Todd Whiteman toddw at activestate.com
Tue Jul 3 20:23:39 EDT 2007


Thorsten Kampe wrote:
> Hi,
> 
> I've already sent this to the Komodo mailing list (which seemed to me 
> the more appropriate place) but unfortunately I got no response.

Hi Thorsten,

I'm sorry that we (Komodo team) missed it, but I did not see such a 
message on the Komodo mailing list.

> 
> I'd like to build a Python GUI app. Neither Tkinter nor Wxpython nor 
> PyQT are actually what I want (because the lack of GUI builders and 
> they don't really look good on Windows and Linux).
> 
> Komodo itself is an excellent example of a - at least Python driven - 
> application that looks superb and has superior functionality so it 
> seems natural to use the Komodo approach for me.
> 
> Some questions
> 
> * Is there a simple How-To how to build a very simple (Python) app 
> with the Mozilla framework? Kind of "Hello world"...?
> 

Just to detail how Komodo works, as there seems to be some confusion on 
this:
* Komodo is based on top of Mozilla (like Firefox, Thunderbird, 
Democracy, etc... )
* Komodo includes PyXPCOM (XPCOM bindings to the Python language), which 
enables JavaScript and C++ components to easily interact with python 
objects inside an embedded Python.
* The Komodo UI is written using XUL/JavaScript and most of the backend 
services are written using Python code.

To enable the use of Python from within the Mozilla framework you'll 
need to build mozilla with the python xpcom extension enabled.

For a simple overview of building and making use of PyXPCOM, see these 
links:
* http://developer.mozilla.org/en/docs/PyXPCOM
* http://developer.mozilla.org/en/docs/Building_PyXPCOM
* http://developer.mozilla.org/en/docs/Creating_a_Python_XPCOM_component

> * Is is reasonable to think that building a GUI with Mozilla is easier 
> than using Python frameworks because Mozilla does most of the GUI 
> work?
> 

I would not recommend this for a small project, as there are many build 
related issues (especially since you'll need to build a separate 
Mozilla/XulRunner application for every platform you support) and a 
steeper learning curve for getting an application like this to work, 
packaged and installable.

Yes, it is definitely a lot easier to build the UI using XUL and it does 
look consistently better across multiple platforms.

Using Mozilla you'll gain access to a wealth of components with which 
you can take advantage of within your application.

Note also that for the Firefox 3 codebase, it is expected that Python 
will become usable in the XUL UI, so instead of writing JavaScript 
you'll be able to write Python code that accesses and manipulates the 
user interface and the DOM.

Cheers,
Todd



More information about the Python-list mailing list