By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,068 Members | 1,734 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,068 IT Pros & Developers. It's quick & easy.

Building a Python app with Mozilla

P: n/a
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.

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"...?

* 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?
Thorsten
Jun 29 '07 #1
Share this Question
Share on Google+
20 Replies


P: n/a
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.

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).
You apparently didn't look very hard. On the wxPython end of things
(which I have experience with), there is wxGlade, XRCed, Boa
Constructor, Dabo, etc. I don't know about Tkinter (I don't use it),
but I know that at least Qt has a very nice GUI designer and builder
(from Trolltech if you are willing to pay for it), and if I remember
correctly, Eric4 offers some tools to make PyQt editing nice and
friendly. I'm sure there are others.

As for wxPython applications not looking good on all platforms; I hate
to break it to you, but the majority of the controls are *native* on
whatever platform you happen to be using (except for Qt-based frontends
in *nix, wxPython uses a Gtk binding in *nix). Take a browse through a
few of the applications listed in the wiki:
http://wiki.wxpython.org/wxPythonPit_Apps , or even Andrea Gavana's
custom widgets http://xoomer.alice.it/infinity77/eng/freeware.html .

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.
I could have sworn that Komodo was written in PyQt. Unless my memory is
failing me (doubtful, as they at least used to offer some PyQt
development tools), I would imagine they merely embedded the mozilla
bits and pieces with some C extensions.

In any case, you really don't want to be developing an application using
XPI. According to everyone I've ever talked to about XPI, while getting
the basic stuff working isn't bad, doing anything worth mentioning is
about as big a pain in the butt than just writing everything in 8088
assembly. You mileage may vary of course.

* Is there a simple How-To how to build a very simple (Python) app
with the Mozilla framework? Kind of "Hello world"...?
Maybe. Search terms you should use are 'embed XPI python', which give
me about 189k results in google, some of which seem applicable on the
first page (which also leads me to believe that my statements regarding
Komodo embedding mozilla technology may be right, though maybe they
wrote Komodo in C and Qt).

* 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?
Doubtful. Building a GUI app with XRCed and wxPython is pretty easy if
you understand Python and object-oriented programming. There are some
annoying vagaries with events, but if you ask your questions on the
wxpython-users mailing list (over at wxpython.org), one of at least a
half-dozen people will likely answer your question.
- Josiah
Jun 30 '07 #2

P: n/a
You apparently didn't look very hard. On the wxPython end of things
(which I have experience with), there is wxGlade, XRCed, Boa
Constructor, Dabo, etc. I don't know about Tkinter (I don't use it),
but I know that at least Qt has a very nice GUI designer and builder
(from Trolltech if you are willing to pay for it), and if I remember
correctly, Eric4 offers some tools to make PyQt editing nice and
friendly. I'm sure there are others.
You're somewhat wrong regarding Qt. The designer is free (I did never
use a commercial Qt, maybe there comes something additional - but IF I
don't have the faintest idea what it could do that would make it better
than the free designer.)

And eric is cool and integrates with Qt (and is an example of a Qt-app
itself), via launching the designer - but it hasn't have any
gui-building stuff in there.

Diez
Jun 30 '07 #3

P: n/a
Thorsten Kampe schrieb:
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.

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).
The latter statement is bogus. Qt is THE native look on KDE. GTK for
Gnome. So how is it not "looking good on linux"?

And as it has been said in this thread already, Qt has an excellent free
GUI-builder.

Diez
Jun 30 '07 #4

P: n/a
[ "Diez B. Roggisch" <de***@nospam.web.de]
And as it has been said in this thread already, Qt has an excellent free
GUI-builder.
Free as long as you develop free software. Development of proprietary,
non-gpl software with Qt requires a commercial licence from Trolltech.

--
Freedom is always the freedom of dissenters.
(Rosa Luxemburg)

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.4 (GNU/Linux)

iD8DBQBGhj8qn3IEGILecb4RAlXPAJ0QjaG0CpKAr9uz7diDGh v6BEPLfACeN63U
bWL/mJWyqO940cQg9uzawVw=
=u938
-----END PGP SIGNATURE-----

Jun 30 '07 #5

P: n/a
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.

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.
Komodo is not a Python application. It is a Mozilla application that
supports Python development. Komodo is more akin to Thunderbird and
Firefox than anything else; it uses the XUL framework for rendering
widgets, if I'm not mistaken. If you want to build an application like
Komodo, get a book on developing with the Mozilla framework (XUL, XPCOM,
and all that) and look at that. Python has little to do with that.

--
Kevin Walzer
Code by Kevin
http://www.codebykevin.com
Jun 30 '07 #6

P: n/a
Sebastian Wiesner schrieb:
[ "Diez B. Roggisch" <de***@nospam.web.de]
>And as it has been said in this thread already, Qt has an excellent free
GUI-builder.

Free as long as you develop free software. Development of proprietary,
non-gpl software with Qt requires a commercial licence from Trolltech.
The OP did debuke Qt because of a lack of a gui-builder, not because of
it's licensing.

Diez
Jun 30 '07 #7

P: n/a
[ "Diez B. Roggisch" <de***@nospam.web.de]
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).

The latter statement is bogus. Qt is THE native look on KDE. GTK for
Gnome. So how is it not "looking good on linux"?
I guess, "not looking good on linux" refers to Tkinter, which is in fact
really ugly on linux systems.
And as it has been said in this thread already, Qt has an excellent free
GUI-builder.
So have Gtk and WxWidgets.

--
Freedom is always the freedom of dissenters.
(Rosa Luxemburg)

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.4 (GNU/Linux)

iD8DBQBGho+Yn3IEGILecb4RAvRzAJwIp/lzT8O/4WwYUU/RxFQztwSUXgCdHPPZ
X/PbnLvKbNZHbcwcQowhnxM=
=+nm1
-----END PGP SIGNATURE-----

Jun 30 '07 #8

P: n/a
Kevin Walzer wrote:
Komodo is not a Python application. It is a Mozilla application that
supports Python development. Komodo is more akin to Thunderbird and
Firefox than anything else; it uses the XUL framework for rendering
widgets, if I'm not mistaken. If you want to build an application like
Komodo, get a book on developing with the Mozilla framework (XUL, XPCOM,
and all that) and look at that. Python has little to do with that.
Most application logic in Komodo is implemented in Python, using the
PyXPCOM bindings. The UI is implemented using XUL and JavaScript. The
editor is Scintilla (C++).

.../Komodo Edit.app/Contents/MacOS % find . -name "*.py" | xargs wc
....
....
126392 456858 4949602 total

This doesn't include the python code in the Python libraries themselves.

Cheers,
Brian
Jun 30 '07 #9

P: n/a
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...PCOM_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
Jul 4 '07 #10

P: n/a
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.

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
I dunno about Windows, but on Linux Komodo/Firefox/etc stick out like
a sore thumb with their ugly, non-native looking widgets (idem. Tk).
wxWidgets will give you native looking apps on both Linux and Windows
(and I think on Macs as well but it's been a while since I looked).

Jul 4 '07 #11

P: n/a
On Jul 4, 2:48 pm, "sjdevn...@yahoo.com" <sjdevn...@yahoo.comwrote:
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.
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

I dunno about Windows, but on Linux Komodo/Firefox/etc stick out like
a sore thumb with their ugly, non-native looking widgets (idem. Tk).
wxWidgets will give you native looking apps on both Linux and Windows
(and I think on Macs as well but it's been a while since I looked).
They stick out like a grand painting at a kid's art class...

-T

Jul 4 '07 #12

P: n/a
sj*******@yahoo.com wrote:
wxWidgets will give you native looking apps on both Linux and Windows
Well, maybe. There's more to getting a native feel than
just using the right widgets. I once saw a Qt-based app on
MacOSX that had tiny little buttons that were too small
for the text they contained -- Aqua buttons just don't
scale down like that. :-(

--
Greg
Jul 5 '07 #13

P: n/a
On Do, 5.07.2007, 03:45, greg wrote:
sj*******@yahoo.com wrote:
>wxWidgets will give you native looking apps on both Linux and Windows

Well, maybe. There's more to getting a native feel than
just using the right widgets. I once saw a Qt-based app on
MacOSX that had tiny little buttons that were too small
for the text they contained -- Aqua buttons just don't
scale down like that. :-(

--
Greg
--
http://mail.python.org/mailman/listinfo/python-list

Qt based buttons don't either.
If some fool uses absolute positioning and sizing,
then it is not the toolkit to blame.
I'm using wxPython for instance and use the sizers and placeholders
there, so this is possible with Qt also.
So, perhaps (which I don't know) Aqua buttons simply don't permit
absolute stuff ?
Or the Aqua programmers read the user interface guidelines carefully ?
Jul 5 '07 #14

P: n/a
Brett Cannon was doing some work with the Firefox security model to
allow Python coding from within Firefox. He may have stopped doing the
work because it would not lead to a PhD. I am really looking forward to
seeing someone making this a possibility.

Stefan Sonnenberg-Carstens wrote:
On Do, 5.07.2007, 03:45, greg wrote:
>sj*******@yahoo.com wrote:

>>wxWidgets will give you native looking apps on both Linux and Windows
Well, maybe. There's more to getting a native feel than
just using the right widgets. I once saw a Qt-based app on
MacOSX that had tiny little buttons that were too small
for the text they contained -- Aqua buttons just don't
scale down like that. :-(

--
Greg
--
http://mail.python.org/mailman/listinfo/python-list
Qt based buttons don't either.
If some fool uses absolute positioning and sizing,
then it is not the toolkit to blame.
I'm using wxPython for instance and use the sizers and placeholders
there, so this is possible with Qt also.
So, perhaps (which I don't know) Aqua buttons simply don't permit
absolute stuff ?
Or the Aqua programmers read the user interface guidelines carefully ?
--
Shane Geiger
IT Director
National Council on Economic Education
sg*****@ncee.net | 402-438-8958 | http://www.ncee.net

Leading the Campaign for Economic and Financial Literacy
Jul 5 '07 #15

P: n/a
greg wrote:
sj*******@yahoo.com wrote:
wxWidgets will give you native looking apps on both Linux and Windows

Well, maybe. There's more to getting a native feel than
just using the right widgets. I once saw a Qt-based app on
MacOSX that had tiny little buttons that were too small
for the text they contained -- Aqua buttons just don't
scale down like that. :-(
wxWidgets isn't Qt-related. wx wraps the Aqua widgets on MacOS, the
gtk widgets on Linux, and the Windows widgets on Windows. So you're
actually using the real platform-specific widgets, and if you follow
the style guidelines you'll get pretty native-looking apps (including
things like the menubar showing up in the app on Linux/Windows but
using the main menubar on Mac).

Last I looked (3.1-ish), Qt didn't use the Aqua widgets but rather
tried to write their own widgets that looked (kinda) like the MacOS
widgets. I hear that may have changed in more recent versions, but I
no longer have a Mac. They did do the menubar correctly even at that
time, though.

Jul 5 '07 #16

P: n/a
sj*******@yahoo.com wrote:
Last I looked (3.1-ish), Qt didn't use the Aqua widgets but rather
tried to write their own widgets that looked (kinda) like the MacOS
widgets.
That might be so, but even if it had used real Aqua widgets,
the same problem would have occurred.

My point was that using native widgets is not in itself
enough to ensure a native experience. There are conventions
about *how* the widgets are used, and other things about
the behaviour that don't relate to widgets at all.

Native widgets are certainly a better thing to start
from, though.

--
Greg
Jul 10 '07 #17

P: n/a
Last I looked (3.1-ish), Qt didn't use the Aqua widgets

Qt is now up to 4.3 and they use native Aqua

--
damjan
Jul 10 '07 #18

P: n/a
Thorsten Kampe a écrit :
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.

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).
Err... Actually, there are GUI builders for wxWidget (the C++ lib behind
wxPython). And since wxWidgets relies on the platform's GUI libs (native
on Windows, GTK or Metal on unices), I don't get the "don't look good"
point ?

Jul 10 '07 #19

P: n/a
Is that why Komodo is so damned slow????
Brian Quinlan wrote:
Kevin Walzer wrote:
>Komodo is not a Python application. It is a Mozilla application that
supports Python development. Komodo is more akin to Thunderbird and
Firefox than anything else; it uses the XUL framework for rendering
widgets, if I'm not mistaken. If you want to build an application like
Komodo, get a book on developing with the Mozilla framework (XUL, XPCOM,
and all that) and look at that. Python has little to do with that.

Most application logic in Komodo is implemented in Python, using the
PyXPCOM bindings. The UI is implemented using XUL and JavaScript. The
editor is Scintilla (C++).

../Komodo Edit.app/Contents/MacOS % find . -name "*.py" | xargs wc
...
...
126392 456858 4949602 total

This doesn't include the python code in the Python libraries themselves.

Cheers,
Brian

Jul 13 '08 #20

P: n/a
Brian Quinlan wrote:
>Most application logic in Komodo is implemented in Python, using the
PyXPCOM bindings. The UI is implemented using XUL and JavaScript. The
editor is Scintilla (C++).

../Komodo Edit.app/Contents/MacOS % find . -name "*.py" | xargs wc
...
...
126392 456858 4949602 total

This doesn't include the python code in the Python libraries themselves.
An interesting breakdown here:
http://www.ohloh.net/projects/10861/analyses/latest

happybrowndog wrote:
Is that why Komodo is so damned slow????
Probably not, no. Pinpointing the reasons for slowness is often a lot
more complicated. Particular slow points in any app/module -- especially
pathologically slow things -- are more often algoritmic than a function
of the language used. Komodo's use of Python is perhaps partially
responsible for a slower startup time than might otherwise be possible
-- but otherwise my experience in Komodo perf work has been algorithmic
issues. Also, if Komodo hadn't been using Python for application logic
since day one we probably wouldn't be much further than Notepad right
now. :)

Cheers,
Trent (komodo developer)

--
Trent Mick
trentm at activestate.com
Jul 14 '08 #21

This discussion thread is closed

Replies have been disabled for this discussion.