Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Lightweight embedding of Firefox Gecko into application whose toplevel is Python--possible?

Thread Tools

Lightweight embedding of Firefox Gecko into application whose toplevel is Python--possible?

Kenneth McDonald
Posts: n/a
Sorry for crossposting to several lists, but from what I can tell, what
I want to do may involve several different areas of expertise. (None of
which I have )

I'd like to use Gecko as the UI for an application mostly implemented in
Python. Ideally, I'd like to somehow come up with a Python module that
wraps the Gecko, so that I can:

1) Create windows whose content is drawn by Gecko.
1) Dynamically manipulate what is shown by Gecko.
2) Respond to mouse events and keypresses occurring on the window Gecko
is in.

I really don't need, or want, anything beyond this. Presumably Gecko
does have some notion of the DOM, since it handles CSS (which I do want)
and CSS needs the DOM to be meaningful. And I'm also assuming that Gecko
has or requires JavaScript, in order to actually do things with the DOM,
or at least to handle DOM events. (Or at the very least to handle mouse
events, since key events could in theory be handled outside of the
layout engine.) But I'd like to be able to build something with _just_
those features.

Given the above, using Firefox or even Xulrunner seems to be very
heavyweight and unnecessary. It would be somewhat nice to be able to
manipulate a XUL DOM to created panes, menus, etc. But even that is not
necessary--so far as I can tell, DOM manipulation+CSS has the ability
right now to do menus, scrollable sidebars, panes, etc.

I'd like to get away from the rest of the FF/Mozilla baggage (especially
XPCOM) because:

1) I don't want to have to deal with XPCOM, chrome stuff, XUL, make
details, XPIDL (or whatever it is), etc. etc. My brain is already too
2) Even if I did want to deal with the above, I find the documentation
for it disorganized and, more often than not, out of date. Not a
criticism, just an unavoidable weakness of open source development with
a large number of developers.

Given that the _only_ thing I really want to use is the Gecko layout
engine with some sort of relatively rudimentary keyboard and mouse
handling (I'll do all of the sophisticated handling in Python), it'd
just be nice to be able to dispense with all of the rest of the stuff.

For the record, I do know that PyXPCOM is still being developed, and
what little I've been able to glean suggests it's been going reasonably
well. However, I'm not sure it will do what I want it to. It appears to
be a way to write XPCOM components in Python, and I have no idea if that
will allow me to just use Python in the same way JavaScript is used
right now, which is what I want. From what little I've been able to
track down it seems that PyXPCOM may only be the starting point for
moving towards using Python for DOM scripting. Also, I'm not sure when
it will actually be done. Up-to-date online info about PyXPCOM (aside
from bug tracking) seems very sparse.

Given all of that, answers to the following questions (or suggestions
related to the whole endeavour) would be appreciated.
1) Does this even seem feasible? Can Gecko be 'broken out' from the
other Moz technologies to this extent?
2) Does anyone know of similar projects?
3) Can anyone point out a simple example of encapsulating Gecko in a
small C/C++ app, and then running/communicating with Gecko from that
code? (i.e. a Gecko embedding "Hello world") This is in some sense what
I'd be doing, since using Gecko from Python would involve (I assume)
wrapping Gecko in a Python-compatible C wrapper. I've come across a
number of embedding Gecko tutorials, but nothing that starts at such a
basic level.
4) Do I need to somehow provide/link in a windowing system of some sort,
or do I get that with the version of Gecko appropriate for the target
5) Will PyXPCOM let me do what I want? And is it close enough that I
should just wait for it? (It doesn't bother me if all of the rest of the
Moz/FF stuff is included in my app, just as long as I don't have to deal
with it.)

Many thanks,
Ken McDonald
Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Embedding Web Browser (prefer Firefox) in Java Application. Daniel Pitts Java 4 05-07-2009 04:35 PM
Tasks and Servlets in Lightweight MVC Application Java 0 03-03-2008 01:20 PM
Embedding an html application into a static html page HTML 5 01-09-2008 04:49 PM
Embedding a database into a Java web start application Dobedani Java 4 09-13-2006 07:53 AM
[Q] Embedding C++/MFC app into java application Jonathan Belson Java 3 04-19-2005 01:45 PM