Building a Python app with Mozilla

T

Thorsten Kampe

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
 
J

Josiah Carlson

Thorsten said:
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
 
D

Diez B. Roggisch

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
 
D

Diez B. Roggisch

Thorsten said:
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
 
S

Sebastian Wiesner

[ "Diez B. Roggisch said:
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)

iD8DBQBGhj8qn3IEGILecb4RAlXPAJ0QjaG0CpKAr9uz7diDGhv6BEPLfACeN63U
bWL/mJWyqO940cQg9uzawVw=
=u938
-----END PGP SIGNATURE-----
 
K

Kevin Walzer

Thorsten said:
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.
 
D

Diez B. Roggisch

Sebastian said:
[ "Diez B. Roggisch said:
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
 
S

Sebastian Wiesner

[ "Diez B. Roggisch said:
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-----
 
B

Brian Quinlan

Kevin said:
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
 
T

Todd Whiteman

Thorsten said:
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
 
S

sjdevnull

Thorsten said:
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).
 
T

tleeuwenburg

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
 
G

greg

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. :-(
 
S

Stefan Sonnenberg-Carstens

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. :-(
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 ?
 
S

Shane Geiger

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.


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
(e-mail address removed) | 402-438-8958 | http://www.ncee.net

Leading the Campaign for Economic and Financial Literacy
 
S

sjdevnull

greg said:
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.
 
G

greg

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.
 
D

Damjan

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
 
B

Bruno Desthuilliers

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 ?
 
H

happybrowndog

Is that why Komodo is so damned slow????


Brian said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,165
Latest member
JavierBrak
Top