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

GUI Frameworks in Python?

P: n/a
I've recently been trying out various different GUI frameworks in Python and
was wondering if I could get your input on the pros and cons of the
different ones...

wxPython: I love the programming side of wxPython, but I find it's just so
slow to initialise in the first place.

Tkinter: While it's fast to load up, the syntax has never really appealed to
me

GTK: Unknown - I'm looking into it today

Qt: I have yet to manage to install it on my system

Anything else?
Hugh Macdonald
Jul 18 '05 #1
Share this Question
Share on Google+
59 Replies


P: n/a
Hugh Macdonald wrote:
I've recently been trying out various different GUI frameworks in Python and
was wondering if I could get your input on the pros and cons of the
different ones...

wxPython: I love the programming side of wxPython, but I find it's just so
slow to initialise in the first place.


I don't understand this, though it's been mentioned before.

On my machine, launching the wxPython Demo app takes roughly 0 seconds
before the splash screen appears, and I can immediately click on it
and get the app itself, for a total launch time of: immeasurably fast.

I would think, given the size of the demo itself, that just about
anything it does should be representative of other apps on the
same machine.

For the record, running WinXP AMD 2200 with adequate RAM etc.

Are these reports of slow wxPython startup only coming from really old
machines or something?

-Peter
Jul 18 '05 #2

P: n/a
Peter Hansen wrote:
...
I don't understand this, though it's been mentioned before.

On my machine, launching the wxPython Demo app takes roughly 0 seconds
before the splash screen appears, and I can immediately click on it
and get the app itself, for a total launch time of: immeasurably fast.


On my machine (WinXP Pro, AMD 2400, 512MB) it takes a little over three
seconds before the splash shows and maybe another two seconds for the
main frame to show. It takes a little over a second to load IDLE.

greg
Jul 18 '05 #3

P: n/a
Greg Krohn wrote:
On my machine (WinXP Pro, AMD 2400, 512MB) it takes a little over three
seconds before the splash shows and maybe another two seconds for the
main frame to show. It takes a little over a second to load IDLE.


Roughly the same here: 2-3 seconds for the Demo and my own wxPython app to
start on a Mac G5. Around 3 seconds on my Pentium II 333 MHz with Linux and
Win2000 as well - you don't need a GHz CPU to create a window with Python.
The only limitation I can think of is limited memory so the OS needs to swap
to free some space first. CPU speed is not a serious factor.
I personally consider wxPython the best choice for a Python GUI. Tkinter
apps look too alien to the common Windows enduser. Of course that depends on
the target audience and might be an issue or not.

Peter
Jul 18 '05 #4

P: n/a
pyGTK is also a good GUI frameworks but it's not available now for windows
platform. I suppose it's its most important shortage.

Phipps
"Hugh Macdonald" <Hu***********@brokenpipefilms.com> wrote in message
news:ma**************************************@pyth on.org...
I've recently been trying out various different GUI frameworks in Python and was wondering if I could get your input on the pros and cons of the
different ones...

wxPython: I love the programming side of wxPython, but I find it's just so
slow to initialise in the first place.

Tkinter: While it's fast to load up, the syntax has never really appealed to me

GTK: Unknown - I'm looking into it today

Qt: I have yet to manage to install it on my system

Anything else?
Hugh Macdonald

Jul 18 '05 #5

P: n/a
On Tue, 30 Mar 2004 16:11:55 +0800
"Phipps Xue" <ph********@sap.com> wrote:
pyGTK is also a good GUI frameworks but it's not available now for
windows platform. I suppose it's its most important shortage.


I'm developing for Linux, so that's less of an issue for me.... Although I did check out the pyGTK module we've got installed here at work and it seems very slightly different from the version in the pyGTL tutorials(mainloop() instead of main_loop(), GtkWindow() instead of Window()...)

--
Hugh Macdonald
The Moving Picture Company

Jul 18 '05 #6

P: n/a
P
Hugh Macdonald wrote:
I've recently been trying out various different GUI frameworks in Python and
was wondering if I could get your input on the pros and cons of the
different ones...

wxPython: I love the programming side of wxPython, but I find it's just so
slow to initialise in the first place.

Tkinter: While it's fast to load up, the syntax has never really appealed to
me

GTK: Unknown - I'm looking into it today


I have to recommend GTK, especially in combination with libglade.
I've a presentation and a couple of sample apps here:
http://www.pixelbeat.org/talks/pygtk

Pádraig.
Jul 18 '05 #7

P: n/a
"Hugh Macdonald" <Hu***********@brokenpipefilms.com> writes:
I've recently been trying out various different GUI frameworks in Python and
was wondering if I could get your input on the pros and cons of the
different ones...

wxPython: I love the programming side of wxPython, but I find it's just so
slow to initialise in the first place.

Tkinter: While it's fast to load up, the syntax has never really appealed to
me

GTK: Unknown - I'm looking into it today

Qt: I have yet to manage to install it on my system

Anything else?


I'm very happy with web interface :-)

--
Wilk - http://flibuste.net
Jul 18 '05 #8

P: n/a
Hugh Macdonald wrote:

Qt: I have yet to manage to install it on my system

Its relatively easy to install and evaluate Qt/PyQt and Eric3
(associated IDE) on a Linux box. That's the easy path.

But its a LOT of work to try on a Windows box. Both Qt and PyQt have
licenses which allow non-commercial use on Linux but ONLY commercial use
on Windows and NO easy path to an evaluation version.

I requested an evaluation versions of Qt for Windows from TrollTech and
didn't get a response for 5 days. Even then it was a response asking
for more detailed information about me, my company and the purpose of
the evaluation. Nothing wrong with that, of course, except the whole
process suddenly looked to be a very protracted one. It wasn't even
clear to me that I could then get an evaluation licence for PyQt. I gave
up. Too hard.

In the end, I found the easiest way to *partially* evaluate PyQt on
Windows is to download the evaluation version of the "BlackAdder" IDE
from "The Kompany". BlackAdder is a toy IDE (IMO) but it does give you
evaluation access to most of the Qt/PyQt libs and to 'Designer' the VERY
IMPRESSIVE GUI builder that comes with Qt. The Qt/PyQt libs provided
with BlackAdder do not include some important parts of the full Qt/PyQt
combination: data aware widgets, etc.

I also note that even full PyQt does not support the ActiveX parts of Qt
which turned out to be a problem for me. Phil Thompson (Mr PyQt) seems
interested in adding ActiveX support, but nothing is there yet.

Also Note: Eric3 is an impressive IDE that targets PyQt development. But
you can't seem to evaluate it on windows, even if you have the
BlackAdder demo version installed, because it requires a component that
only comes with the full Qt/PyQt lib.

So all in all, I wouldn't even try to evaluate PyQt/Qt on Windows, just
go straight to a Linux box. (And be aware of the ActiveX limitations of
PyQt once you get back to Windows).

You also need to be aware of the cost of PyQt/Qt. Its expensive! About
US$2500 for Qt (per seat) and 250 English pounds for PyQt (per seat).

Buying BlackAdder seems to give you access to a subset of the full
PyQt/Qt libraries at a significantly reduced cost.


Anything else?


No. You've covered the main ones.

If evaluating wxPython, you may also want to look at wxDesigner. It not
a patch on Qt's Designer, but it seemed to me to be the best available.
There's also wxGlade and Boa.
BTW, I was recently reacquainted with VisualWorks (Smalltalk from
CinCom) ... not THAT's an IDE!! What a shame Python was nothing to come
close, despite both languages sharing a similar dynamic nature.

--
Mike

Jul 18 '05 #9

P: n/a
Hugh Macdonald wrote:
I've recently been trying out various different GUI frameworks in Python and
was wondering if I could get your input on the pros and cons of the
different ones...

wxPython: I love the programming side of wxPython, but I find it's just so
slow to initialise in the first place.


Not noticed this myself but I would like to add here that wxPython is
wonderfully portable. I have run wxPython apps on my OSX machine that
were developed exclusively on a Windows machine without any problems.

Portability is my biggest concern when writing GUI code so I would push
for wxPython.
Jul 18 '05 #10

P: n/a
Hugh Macdonald wrote:
On Tue, 30 Mar 2004 16:11:55 +0800
"Phipps Xue" <ph********@sap.com> wrote:

pyGTK is also a good GUI frameworks but it's not available now for
windows platform. I suppose it's its most important shortage.

I'm developing for Linux, so that's less of an issue for me.... Although I did check out the pyGTK module we've got installed here at work and it seems very slightly different from the version in the pyGTL tutorials(mainloop() instead of main_loop(), GtkWindow() instead of Window()...)


I can't vouch for it, but the following FAQ entry describes using PyGTK
on Windows:

<http://www.async.com.br/faq/pygtk/index.py?req=show&file=faq21.012.htp>

If you're going to evaluate PyGTK, do yourself a favor and look at 2.0,
or later. If it has GtkWindow, it's ancient. If it has gtk.Window,
it's recent. While a GUI builder isn't essential, I recommend also
looking at GLADE 2 and libglade.
Jul 18 '05 #11

P: n/a
"Hugh Macdonald" <Hu***********@brokenpipefilms.com> wrote in message news:<ma**************************************@pyt hon.org>...
I've recently been trying out various different GUI frameworks in Python and
was wondering if I could get your input on the pros and cons of the
different ones...

wxPython: I love the programming side of wxPython, but I find it's just so
slow to initialise in the first place.

Never tried it - see below :-)
Tkinter: While it's fast to load up, the syntax has never really appealed to
me

'Programming Python' has an excellent introduction.. so I started with
Tkinter thinking that when I hit restrictions I could move onto wx. I
haven't yet reached the point where Tkinter restricts me. Whereas
there are a couple of widgets missing from the standard distribution,
Tkinter *can* be used to make clean and modern looking interfaces.....
And the syntax isn't too gawky once you've climbed the initial
learning curve.
GTK: Unknown - I'm looking into it today

Is this Linux only ?
(pardon my terrible ignorance...)
Qt: I have yet to manage to install it on my system
Although *technically* cross platform, windoze users can't get a free
version... so I'm never going to bother looking at it...

On the other hand Kodos - (a regular expression tool) has an
'executable' version with the libraries bundled with it. And the GUI
it has is very nice. Whether it would be possible to extract the
windoze libraries from the Kodos executable distribution is an
interesting question - lol.
Anything else?

Anyway - most of my contribution is mad rambling.....

Regards,

Fuzzy

http://www.voidspace.org.uk/atlantib...thonutils.html

Hugh Macdonald

Jul 18 '05 #12

P: n/a
Greg Krohn wrote:
Peter Hansen wrote:
...
I don't understand this, though it's been mentioned before.

On my machine, launching the wxPython Demo app takes roughly 0 seconds
before the splash screen appears, and I can immediately click on it
and get the app itself, for a total launch time of: immeasurably fast.


On my machine (WinXP Pro, AMD 2400, 512MB) it takes a little over three
seconds before the splash shows and maybe another two seconds for the
main frame to show. It takes a little over a second to load IDLE.


The first time I launched IDLE, it took almost three seconds. (I don't
have the Python installer compile .py files ahead of time.) After that
it takes about one second as well.

I'm curious about the differences with wxPython. Three seconds seems
unusually long when on a slightly slower machine I can do it in well
under a second. Was that the first time you ran it? Many other apps
open? I have over 256MB RAM free when I try this...

-Peter
Jul 18 '05 #13

P: n/a
On 30 Mar 2004 05:18:58 -0800
mi*****@foord.net (Fuzzyman) wrote:
'Programming Python' has an excellent introduction.. so I started with
Tkinter thinking that when I hit restrictions I could move onto wx. I
haven't yet reached the point where Tkinter restricts me. Whereas
there are a couple of widgets missing from the standard distribution,
Tkinter *can* be used to make clean and modern looking interfaces.....
And the syntax isn't too gawky once you've climbed the initial
learning curve.


For me, the issue with TK is less the restrictions it imposes and more the way of writing it in the first place.
GTK: Unknown - I'm looking into it today


Is this Linux only ?
(pardon my terrible ignorance...)


Yeah - it is... I'n only developing for Linux here...
Qt: I have yet to manage to install it on my system

Although *technically* cross platform, windoze users can't get a free
version... so I'm never going to bother looking at it...


That doesn't bother me - everything I'm writing is for in-house use only, and would only ever be run on Linux...

Thanks for everyones thoughts... I'm actually planning on sticking with wxPython for the moment. I've decided that I can live with the extra few seconds to load up, although I don't like it...

--
Hugh Macdonald
The Moving Picture Company

Jul 18 '05 #14

P: n/a
Peter Hansen wrote:
Hugh Macdonald wrote:
wxPython: I love the programming side of wxPython, but I find it's
just so slow to initialise in the first place.


I don't understand this, though it's been mentioned before.

On my machine, launching the wxPython Demo app takes roughly 0 seconds
before the splash screen appears, and I can immediately click on it
and get the app itself, for a total launch time of: immeasurably fast.

I would think, given the size of the demo itself, that just about
anything it does should be representative of other apps on the
same machine.


Whenever I make even the smallest wxPython program, it takes multiple
seconds before the window is visible. Last time I tried was on a Pentium
4-M 2.2 GHz with 512 MB of RAM. Not a slow machine, and other software
runs just fine.

It's really annoying, and nothing I do seems to improve the situation.

--
"Codito ergo sum"
Roel Schroeven
Jul 18 '05 #15

P: n/a

[Peter]
I'm curious about the differences with wxPython. Three seconds seems
unusually long when on a slightly slower machine I can do it in well
under a second. Was that the first time you ran it? Many other apps
open? I have over 256MB RAM free when I try this...


I tried it on this 3GHz 1GB XP box and it took 3.5 seconds to bring up the
wxPython demo's splash banner. That was with lots of other stuff running and
not having run it before during this session, but with plenty of available RAM
and nothing soaking the processor. Try it after a clean boot or a good long
disk-cache-hammering spell of doing something else - you might find it's
slower than you think.

--
Richie Hindle
ri****@entrian.com
Jul 18 '05 #16

P: n/a
Peter Hansen wrote:
The first time I launched IDLE, it took almost three seconds. (I don't
have the Python installer compile .py files ahead of time.) After that
it takes about one second as well.


Compiling is not the problem. The time for first launch is spent
for loading ~ 10 MB of executables into memory. I tried this
on my Win2000, 800 MHz, 256 MByte computer:

- start wxpython app (stand alone tree.py from the demo): ~ 3-4 sec
- repeat start: < 1 sec
- delete *.pyc, repeat start: < 1 sec
- reboot, repeat start with *.pyc: ~ 3-4 sec

I was watching system performance simultaneously and noticed a
decrease of free RAM memory by ~ 10 MB on starting and the same
increase on stopping. But the dlls - once loaded - apparently
are kept in RAM.

Mit freundlichen Gruessen,

Peter Maas

--
-------------------------------------------------------------------
Peter Maas, M+R Infosysteme, D-52070 Aachen, Hubert-Wienen-Str. 24
Tel +49-241-93878-0 Fax +49-241-93878-20 eMail pe********@mplusr.de
-------------------------------------------------------------------
Jul 18 '05 #17

P: n/a
Richie Hindle wrote:
[Peter]
I'm curious about the differences with wxPython. Three seconds seems
unusually long when on a slightly slower machine I can do it in well
under a second. Was that the first time you ran it? Many other apps
open? I have over 256MB RAM free when I try this...

I tried it on this 3GHz 1GB XP box and it took 3.5 seconds to bring up the
wxPython demo's splash banner. That was with lots of other stuff running and
not having run it before during this session, but with plenty of available RAM
and nothing soaking the processor. Try it after a clean boot or a good long
disk-cache-hammering spell of doing something else - you might find it's
slower than you think.


Something's wrong with your box then. :-)

Rebooted. No wxPython apps run first. Clicked on Demo icon and said
"one thousand and wuh--" and the splash banner appeared. Run it again
and I get as far as "one thou--", so clearly there is some difference
between the two and it's not pilot error. (Barring the possibility,
which always exists, that it still _is_ pilot error. :-)

Go figure. (And as I said this is an AMD 2200 with 512MB RAM, XP Pro.)

-Peter
Jul 18 '05 #18

P: n/a
On Tue, 30 Mar 2004 14:35:20 +0100, Hugh Macdonald wrote:
On 30 Mar 2004 05:18:58 -0800
mi*****@foord.net (Fuzzyman) wrote:
'Programming Python' has an excellent introduction.. so I started with
Tkinter thinking that when I hit restrictions I could move onto wx. I
haven't yet reached the point where Tkinter restricts me. Whereas
there are a couple of widgets missing from the standard distribution,
Tkinter *can* be used to make clean and modern looking interfaces.....
And the syntax isn't too gawky once you've climbed the initial
learning curve.


For me, the issue with TK is less the restrictions it imposes and more the way of writing it in the first place.
> GTK: Unknown - I'm looking into it today
>


Is this Linux only ?
(pardon my terrible ignorance...)


Yeah - it is... I'n only developing for Linux here...


It's false.
I'm developping a gtk program which run in both linux and windows.

lopster, a peer-to-peer sharing programs, it's developped with gtk, and it
runs on windows too.

Ciao,
Riccardo

--
-=Riccardo Galli=-

_,e.
s~ ``
~@. ideralis Programs
.. ol
`**~ http://www.sideralis.net
Jul 18 '05 #19

P: n/a
On Tue, 30 Mar 2004 16:11:55 +0800, Phipps Xue wrote:
pyGTK is also a good GUI frameworks but it's not available now for windows
platform. I suppose it's its most important shortage.


???
I'm using it to develop a linux/windows app.
And it works.

Ciao,
Riccardo

--
-=Riccardo Galli=-

_,e.
s~ ``
~@. ideralis Programs
.. ol
`**~ http://www.sideralis.net
Jul 18 '05 #20

P: n/a
On Tue, 30 Mar 2004 20:21:58 +0200
Riccardo Attilio Galli <ri*************@cut.me.sideralis.net> wrote:

> GTK: Unknown - I'm looking into it today
>

Is this Linux only ?
(pardon my terrible ignorance...)


Yeah - it is... I'n only developing for Linux here...


It's false.
I'm developping a gtk program which run in both linux and windows.


Sorry - when I answered the original question I thought he was asking if I was developing for Linux only... looking back, I have no idea why I got that idea....

--
Hugh Macdonald
The Moving Picture Company

Jul 18 '05 #21

P: n/a
On Tue, 30 Mar 2004 10:58:58 -0500
Peter Hansen <pe***@engcorp.com> wrote:
Rebooted. No wxPython apps run first. Clicked on Demo icon and said
"one thousand and wuh--" and the splash banner appeared. Run it again
and I get as far as "one thou--", so clearly there is some difference
between the two and it's not pilot error.


I just wrote the following simple script:

-------------------------------------------------
#!/software/python/python2.2.2/linux/bin/python
import time
startTime = time.time()
from wxPython.wx import *
print "Time:",time.time()-startTime
-------------------------------------------------

On running multiple times, I get the following outputs:

Time: 4.60863804817
Time: 3.26165890694
Time: 3.24744296074
Time: 3.26767706871
Time: 3.25304102898

Definately something going on here..... going to try a reboot....

--
Hugh Macdonald
The Moving Picture Company

Jul 18 '05 #22

P: n/a
Hugh Macdonald wrote:
I just wrote the following simple script:

-------------------------------------------------
#!/software/python/python2.2.2/linux/bin/python
import time
startTime = time.time()
from wxPython.wx import *
print "Time:",time.time()-startTime
-------------------------------------------------

On running multiple times, I get the following outputs:

Time: 4.60863804817
Time: 3.26165890694
Time: 3.24744296074
Time: 3.26767706871
Time: 3.25304102898


Running that repeatedly (sorry, can't reboot conveniently
right now, so can't get the first time) it takes 0.125 s
on my machine.

-Peter
Jul 18 '05 #23

P: n/a
> I was watching system performance simultaneously and noticed a
decrease of free RAM memory by ~ 10 MB on starting and the same
increase on stopping. But the dlls - once loaded - apparently
are kept in RAM.


That is what Windows does. Using an oft used cliche in a different
realm that always made me laugh, "Don't hate the player, hate the game".
In this case, the player is wxPython, the game is 'running on Windows'.

There may be some method to tell windows to evict currently unused dlls,
but I wouldn't hold my breath.

- Josiah
Jul 18 '05 #24

P: n/a
On Tuesday 30 March 2004 05:35 am, Hugh Macdonald wrote:
GTK: Unknown - I'm looking into it today


Is this Linux only ?
(pardon my terrible ignorance...)


Yeah - it is... I'n only developing for Linux here...


No! GTK is most definitely cross platform. I use it on both Windows
and Linux with great success. And it's very consistent in the sense
that my GUI looks identical on both platforms. I have almost no need
for any platform dependent code in my GUI layout. (Unlike Tkinter and
wxPython where I remember having to tweek fonts and other things on a
platform by platform basis.)

Here's several pointers:
http://www.async.com.br/faq/pygtk/in...=faq21.012.htp
http://www.pcpm.ucl.ac.be/~gustin/win32_ports/

Gary Herron

Jul 18 '05 #25

P: n/a
At some point, Gary Herron <gh*****@islandtraining.com> wrote:
On Tuesday 30 March 2004 05:35 am, Hugh Macdonald wrote:
> > GTK: Unknown - I'm looking into it today
>
> Is this Linux only ?
> (pardon my terrible ignorance...)


Yeah - it is... I'n only developing for Linux here...


No! GTK is most definitely cross platform. I use it on both Windows
and Linux with great success. And it's very consistent in the sense


There's no (working) native port for Mac OS X [1], so I'd call it only mostly
cross-platform. You could use the X version, and run an X server, but
I could argue you could do the same under Windows...

[1] there are some partly-complete ports of GTK 1.2, but nothing for
GTK 2.x

--
|>|\/|<
/--------------------------------------------------------------------------\
|David M. Cooke
|cookedm(at)physics(dot)mcmaster(dot)ca
Jul 18 '05 #26

P: n/a
Peter Hansen wrote:

The first time I launched IDLE, it took almost three seconds. (I don't
have the Python installer compile .py files ahead of time.) After that
it takes about one second as well.

I'm curious about the differences with wxPython. Three seconds seems
unusually long when on a slightly slower machine I can do it in well
under a second. Was that the first time you ran it? Many other apps
open? I have over 256MB RAM free when I try this...

-Peter


Running Hugh's timing script from the command prompt, right after a
reboot, I get 1.1 seconds. Then on successive runs I get between 0.1 and
0.2 seconds. Then I ran the wx demo (without rebooting) and it was just
under 1.5 seconds for the splash. On successive runs it was well under 1
second.

So, maybe wxPython's not as bad as I thought. It's like my car in the
winter: I need to run out and start it up every few hours to make sure I
can make it home. ;)

greg
Jul 18 '05 #27

P: n/a
I'm really sorry for my ignorance of pyGTK in Windows. I've installed pyGTK
in my desktop by following Jon's reply message.

I feel it's really so cool, after run a helloworld application.

Phipps
"Phipps Xue" <ph********@sap.com> wrote in message
news:c4**********@news1.wdf.sap-ag.de...
pyGTK is also a good GUI frameworks but it's not available now for windows
platform. I suppose it's its most important shortage.

Phipps
"Hugh Macdonald" <Hu***********@brokenpipefilms.com> wrote in message
news:ma**************************************@pyth on.org...
I've recently been trying out various different GUI frameworks in Python and
was wondering if I could get your input on the pros and cons of the
different ones...

wxPython: I love the programming side of wxPython, but I find it's just so slow to initialise in the first place.

Tkinter: While it's fast to load up, the syntax has never really

appealed to
me

GTK: Unknown - I'm looking into it today

Qt: I have yet to manage to install it on my system

Anything else?
Hugh Macdonald


Jul 18 '05 #28

P: n/a
Hugh Macdonald <Hu***********@brokenpipefilms.com> wrote in message news:<ma**************************************@pyt hon.org>...
On 30 Mar 2004 05:18:58 -0800
mi*****@foord.net (Fuzzyman) wrote:
'Programming Python' has an excellent introduction.. so I started with
Tkinter thinking that when I hit restrictions I could move onto wx. I
haven't yet reached the point where Tkinter restricts me. Whereas
there are a couple of widgets missing from the standard distribution,
Tkinter *can* be used to make clean and modern looking interfaces.....
And the syntax isn't too gawky once you've climbed the initial
learning curve.
For me, the issue with TK is less the restrictions it imposes and more the way of writing it in the first place.


I guess there are two 'warts' :

callback functions are usually called without parameters.

Wrapping the GUI framework in a class gets round this nicely - the
callback function has full access to the class instance attributes.

The second is the way that events are triggered with an event object :
self.searchbox.bind('<Return>', (lambda event: self.search()))

Using a lambda function to trigger a callback function gets round
that.

Once you get used to the pack order with Tk it's remarkably easy to
build GUIs quickly....

I guess for *big* applications some of the 'power' widgets might be
missing from the standard distribution. In that sense wx is
undoubtably more polished and fully featured.... But so far for me -
Tk has more than covered my needs without even exploring extension
widget sets. Apparently one of the more high powered IDEs (I forget
which one) is seamlessly built from Tk widgets.... but you'd never
realise it to look at it - so I guess the potential is there.

Regards,
Fuzzy

http://www.voidspace.org.uk/atlantib...thonutils.html

GTK: Unknown - I'm looking into it today


Is this Linux only ?
(pardon my terrible ignorance...)


Yeah - it is... I'n only developing for Linux here...
Qt: I have yet to manage to install it on my system

Although *technically* cross platform, windoze users can't get a free
version... so I'm never going to bother looking at it...


That doesn't bother me - everything I'm writing is for in-house use only, and would only ever be run on Linux...

Thanks for everyones thoughts... I'm actually planning on sticking with wxPython for the moment. I've decided that I can live with the extra few seconds to load up, although I don't like it...

Jul 18 '05 #29

P: n/a
Josiah Carlson wrote:
I was watching system performance simultaneously and noticed a
decrease of free RAM memory by ~ 10 MB on starting and the same
increase on stopping. But the dlls - once loaded - apparently
are kept in RAM.


That is what Windows does. Using an oft used cliche in a different
realm that always made me laugh, "Don't hate the player, hate the game".
In this case, the player is wxPython, the game is 'running on Windows'.


After stopping the wxpython app Windows reports its memory share as
free, i.e. usable for other applications. If the same application
is reloaded and its binary stuff is not yet overwritten it is reused.
That's a good thing IMO, not a flaw. It would be nice though to
configure this behaviour, e.g. for testing. Perhaps there's a
registry spell in one of the numerous guru books for Win* but my
interest doesn't go this far.

Mit freundlichen Gruessen,

Peter Maas

--
-------------------------------------------------------------------
Peter Maas, M+R Infosysteme, D-52070 Aachen, Hubert-Wienen-Str. 24
Tel +49-241-93878-0 Fax +49-241-93878-20 eMail pe********@mplusr.de
-------------------------------------------------------------------
Jul 18 '05 #30

P: n/a
Roel Schroeven wrote:
Whenever I make even the smallest wxPython program, it takes multiple
seconds before the window is visible. Last time I tried was on a Pentium
4-M 2.2 GHz with 512 MB of RAM. Not a slow machine, and other software
runs just fine.

It's really annoying, and nothing I do seems to improve the situation.


Did you try a preload? You can start an invisible task that keeps
the wxpython stuff in memory. You could even start this task as a
Win32 service so that it is loaded prior to any login.

BTW, the load time is not only due to GUI libs. Python itself does
also have a share. Just tried that with a command line script and
my rough estimate is that approx. 50% of the wxpython load delay
is due to Python itself (at least on my machine: Win 2000, 800MHz,
256 MByte).

Mit freundlichen Gruessen,

Peter Maas

--
-------------------------------------------------------------------
Peter Maas, M+R Infosysteme, D-52070 Aachen, Hubert-Wienen-Str. 24
Tel +49-241-93878-0 Fax +49-241-93878-20 eMail pe********@mplusr.de
-------------------------------------------------------------------
Jul 18 '05 #31

P: n/a
Gary Herron wrote:
On Tuesday 30 March 2004 05:35 am, Hugh Macdonald wrote:
GTK: Unknown - I'm looking into it today

Is this Linux only ?
(pardon my terrible ignorance...)
Yeah - it is... I'n only developing for Linux here...


<snip GTK _is_ cross-platform>
Here's several pointers:
http://www.async.com.br/faq/pygtk/in...=faq21.012.htp
http://www.pcpm.ucl.ac.be/~gustin/win32_ports/

Gary Herron


Hi,

i downloaded and installed the GTK runtime environment v. 2.2.4-2 and
PyGTK 2.2.0 for Python 2.3. The installation went fine and I added the
path to GTK/lib and bin. I run a helloworld program, but unfortunely I
get this error message which I quite puzzled about (translated from danish)

(helloworld.py:3308): Gtk-WARNING **: Could not find the theme engine in
module_path: 'wimp'

Does anyone have clue what to do?

Regards
Jorgen Cederberg
Jul 18 '05 #32

P: n/a
Peter Maas wrote:
Roel Schroeven wrote:
Whenever I make even the smallest wxPython program, it takes multiple
seconds before the window is visible. Last time I tried was on a
Pentium 4-M 2.2 GHz with 512 MB of RAM. Not a slow machine, and other
software runs just fine.

It's really annoying, and nothing I do seems to improve the situation.

Did you try a preload? You can start an invisible task that keeps
the wxpython stuff in memory. You could even start this task as a
Win32 service so that it is loaded prior to any login.


That might be a good idea -- I'll try that the next time I'm doing some
wxPython work.
BTW, the load time is not only due to GUI libs. Python itself does
also have a share. Just tried that with a command line script and
my rough estimate is that approx. 50% of the wxpython load delay
is due to Python itself (at least on my machine: Win 2000, 800MHz,
256 MByte).


In my experience, loading Python itself is very fast. Perhaps not if it
isn't yet cached in memory, but afterwards that doesn't seem to be where
the problem is.

That said, I just tried a simple little program, and it seems to be much
faster than what I remember from 6 months ago. I'm not doing any
wxPython work right now, but I'll do some more checking before
complaining about startup speed again.

--
"Codito ergo sum"
Roel Schroeven
Jul 18 '05 #33

P: n/a
GUI's seem to be more like documents than programs, so I wonder why
we're not considering more declarative type interface builders. Is
there such a thing, maybe that writes out a standard specification
file instead of code? If it were XML, you could write a XSL filter to
make the all the modifications you needed to accomodate a different
platform.

Another thing: I understand that Miguel de (I forget), the Gnome guy,
has stated that the two programs that really have done cross platform
best are Mozilla and Abiword. There was once a Python binding for
Mozilla's widget library XUL but I don't don't what's happended to
that. Anone know if this is relevant to our discussion of cross
platform GUI's?
Jul 18 '05 #34

P: n/a
Andrew Malcolmson wrote:
GUI's seem to be more like documents than programs, so I wonder why
we're not considering more declarative type interface builders.


Mitch Kapor talked about this, I believe, as being part of the
Chandler project's approach, at the Birds-Of-a-Feather session on
Chandler at PyCon last week.

There might be notes about this somewhere, maybe in the docs on
http://www.osafoundation.org/

-Peter
Jul 18 '05 #35

P: n/a
Hi Andrew,
best are Mozilla and Abiword. There was once a Python binding for
Mozilla's widget library XUL but I don't don't what's happended to
that. Anone know if this is relevant to our discussion of cross
platform GUI's?


I think, Mozilla is relevant for x-platform GUIs
There is an interesting project (but wrong licence, in IMO), called
MozPython, which embeds Python into Mozilla.
http://www.thomas-schilz.de/MozPython/README.html

pyXPCOM is still alive, but I think, the lack of pyXPCOM documentation
is a problem here.
ActiveState's Komodo is build with Mozilla and pyXPCOM
http://www.thomas-schilz.de/MozPython/README.html

Another problem of Mozilla / XUL is, that you've to switch between
your programming languages: JavaScript for XUL and your favorite
programming language in the back. If your favorite programming lang
is JavaScript, you don't have to switch, of course. ;)

If someone is interested in Mozilla as platform, than the following
sources might be helpful:

XUL / XPCOM
http://www.xulplanet.com/
http://www.xulplanet.com/forum/

ActiveState's site abt. pyXPCOM
http://aspn.activestate.com/ASPN/Dow...omodo/PyXPCOM/

http://pyxpcom.mozdev.org/ (outdated / dead?)

IBM dW serie about pyXPCOM
http://www-106.ibm.com/developerwork.../co-pyxp1.html
http://www.ibm.com/developerworks/co.../co-pyxp2.html
http://www.ibm.com/developerworks/co...rary/co-pyxp3/

Best regards,
Lars
Jul 18 '05 #36

P: n/a
If someone is interested in Mozilla as platform, than the following
sources might be helpful:


.... and of course:
"Creating Applications with Mozilla"
http://books.mozdev.org/chapters/index.html

Best regards,
Lars
Jul 18 '05 #37

P: n/a
Peter Hansen <pe***@engcorp.com> wrote in message news:<qY********************@powergate.ca>...

Go figure. (And as I said this is an AMD 2200 with 512MB RAM, XP Pro.)


You and all others miss one important number: What a harddisk are you
using ?
A notebook with a 4200rpm has a much lower startup time then a
7200rpm. It is as strange as a 10 against 2 seconds for the same
program on WinXP when compiled with Borland instead MS Visual C.
Jul 18 '05 #38

P: n/a
> GUI's seem to be more like documents than programs, so I wonder why
we're not considering more declarative type interface builders. Is
there such a thing, maybe that writes out a standard specification
file instead of code? If it were XML, you could write a XSL filter to
make the all the modifications you needed to accomodate a different
platform.


Dude, you should really check out the wxXMLResource and
wxXMLResourceHandler. I don't use XML to write GUIs, but if I did,
those would be my savior.

Download the wxPython demo and give it a look.

- Josiah
Jul 18 '05 #39

P: n/a

I second the recommendation of Gtk/Glade/libglade with Python. I've
used it to write large programs and can confirm that gtk2 will also
work on Windows (although I haven't done much other than verify it
works). I've written some software to further automate the process of
writing GUI programs using Glade/libglade. I'm putting the finishing
touches on an article I will be submitting to Linux Journal describing
the software. It will hopefully be published in the July issue. I will
be releasing the software under the GPL license.

I am almost certain that on Linux/Unix wxWindows is just a layer on
top of gtk so gtk will certainly be a little faster than
wxWindows. I'm not certain what wxWindows runs on top of on MS
Windows.

Dave

Jul 18 '05 #40

P: n/a
Lothar Scholz wrote:
Peter Hansen <pe***@engcorp.com> wrote in message news:<qY********************@powergate.ca>...

Go figure. (And as I said this is an AMD 2200 with 512MB RAM, XP Pro.)

You and all others miss one important number: What a harddisk are you
using ?
A notebook with a 4200rpm has a much lower startup time then a
7200rpm. It is as strange as a 10 against 2 seconds for the same
program on WinXP when compiled with Borland instead MS Visual C.


An excellent question...

My hard disk is a "lightning fast" Seagate 120GB 7200 RPM Serial-ATA
drive with liquid bearings and an 8MB cache...

Clearly it's those liquid bearings that make it so fast. ;-)

-Peter
Jul 18 '05 #41

P: n/a
Lars Heuer <py****@quixs.com> schreef:
Another problem of Mozilla / XUL is, that you've to switch between
your programming languages: JavaScript for XUL and your favorite
programming language in the back. If your favorite programming lang
is JavaScript, you don't have to switch, of course. ;)


But look at what Mozilla.org are planning:
<http://www.mozilla.org/events/dev-day-feb-2004/mozilla-futures/langs.html>

--
JanC

"Be strict when sending and tolerant when receiving."
RFC 1958 - Architectural Principles of the Internet - section 3.9
Jul 18 '05 #42

P: n/a
Jørgen Cederberg <jo*************@hotmail.com> wrote in message news:<Fq***************@news.get2net.dk>...

Hi,

i downloaded and installed the GTK runtime environment v. 2.2.4-2 and
PyGTK 2.2.0 for Python 2.3. The installation went fine and I added the
path to GTK/lib and bin. I run a helloworld program, but unfortunely I
get this error message which I quite puzzled about (translated from danish)

(helloworld.py:3308): Gtk-WARNING **: Could not find the theme engine in
module_path: 'wimp'

Does anyone have clue what to do?

Regards
Jorgen Cederberg


I had the same harmless warning and I moved libwimp.dll to
somewhere\GTK\2.0\lib\gtk-2.0\2.2.0\engines (a new directory, sister
of "loaders" and "immodules").

Lorenzo Gatti
Jul 18 '05 #43

P: n/a
Peter Hansen <pe***@engcorp.com> wrote in message news:<Xb********************@powergate.ca>...
Running that repeatedly (sorry, can't reboot conveniently
right now, so can't get the first time) it takes 0.125 s
on my machine.


Nobody seems to have mentioned wxPython version numbers in this
discussion.

I just upgraded from 2.4.2.4 to 2.5.1.5, and the start-up time for the
demo app went from about 5 seconds to less than a second.
Chris
Jul 18 '05 #44

P: n/a
Chris Perkins wrote:
Peter Hansen <pe***@engcorp.com> wrote in message news:<Xb********************@powergate.ca>...

Running that repeatedly (sorry, can't reboot conveniently
right now, so can't get the first time) it takes 0.125 s
on my machine.


Nobody seems to have mentioned wxPython version numbers in this
discussion.

I just upgraded from 2.4.2.4 to 2.5.1.5, and the start-up time for the
demo app went from about 5 seconds to less than a second.


I've been running 2.4.1.2 on Python 2.3.3... If I had the same
absolute speedup going to 2.5.1.5 it would be running before
I managed to click on its icon! ;-)

-Peter
Jul 18 '05 #45

P: n/a
Chris Perkins wrote:
I just upgraded from 2.4.2.4 to 2.5.1.5, and the start-up time for the
demo app went from about 5 seconds to less than a second.


Wow! I'd really like to know how this was accomplished. Do you know?
(Robin?)

Shane

Jul 18 '05 #46

P: n/a
Peter Hansen wrote:
Hugh Macdonald wrote:
I just wrote the following simple script:

-------------------------------------------------
#!/software/python/python2.2.2/linux/bin/python
import time
startTime = time.time()
from wxPython.wx import *
print "Time:",time.time()-startTime
-------------------------------------------------

On running multiple times, I get the following outputs:

Time: 4.60863804817
Time: 3.26165890694
Time: 3.24744296074
Time: 3.26767706871
Time: 3.25304102898


Running that repeatedly (sorry, can't reboot conveniently
right now, so can't get the first time) it takes 0.125 s
on my machine.


Just upgraded to the newly released (thank you so very much
for all your work Robin Dunn... now get back to that book! ;-)
2.5.1.5 to compare, sort of, with Chris Perkins' results.

Now it consistently takes 0.20 seconds to run the above on
my machine... how very odd.

-Peter
Jul 18 '05 #47

P: n/a
"Hugh Macdonald" <Hu***********@brokenpipefilms.com> wrote in message news:<ma**************************************@pyt hon.org>...
I've recently been trying out various different GUI frameworks in Python and
was wondering if I could get your input on the pros and cons of the
different ones...

wxPython: I love the programming side of wxPython, but I find it's just so
slow to initialise in the first place.

Tkinter: While it's fast to load up, the syntax has never really appealed to
me

GTK: Unknown - I'm looking into it today

Qt: I have yet to manage to install it on my system

Anything else?
Hugh Macdonald


Man, you better use PyGTK (http://pygtk.org). It's portable (See pygtk
faq for windows port). It's neet (API).
Try also `glade`, `libglade`.
http://glade.gnome.org , I think?
Jul 18 '05 #48

P: n/a
sr*************@yahoo.com (Sridhar R) wrote in message news:<93**************************@posting.google. com>...

Man, you better use PyGTK (http://pygtk.org). It's portable (See pygtk
faq for windows port). It's neet (API).
Try also `glade`, `libglade`.
http://glade.gnome.org , I think?


Can someone outline some differences/advantages of PyGTK vs. wxPython?

A first look at PyGTK shows me a more Unix-like look-and-feel. On the
other hand, wxPython on Windows does look very much like any other
Windows applications.

Is the event handling in PyGTK cleaner/better than wxPython? Does
PyGTK have more widgets? The FAQ of PyGTK does not have a comparison
section regarding other GUI toolkits, I think it would be useful if
one were included. (If you go to wxPython's mainpage, you read "Why
the hell hasn't wxPython become the standard GUI for Python yet?", and
also "BTW, great work! I've definitively switched from Tk. I work on
Win32, anybody who works on Win32 should switch!". Comments like that.
Readers can immediately know the relationship to Tk, and wxPython's
platform friendliness for Win32.) Given the lack of comparison, I
would guess that GTK is unix-friendly, since Unix people usually would
mention little or nothing about Windows. :) Continuing with my guess:
are there any caveats for using PyGTK for Windows programmers?

---------------------------

Given my observations, is it fair to say:

(a) wxPython is widely used for Windows Python programmers, and
(b) PyGTK is widely used for Unix Python programmers?

regards,

Hung Jung
Jul 18 '05 #49

P: n/a
In article <ma**************************************@python.o rg>, Hugh Macdonald wrote:
I've recently been trying out various different GUI frameworks in Python and
was wondering if I could get your input on the pros and cons of the
different ones...

I would take a strong, close look at Tkinter again. In my opinion,
people have dismissed Tk as 'old technology', but I have seen
nothing else that remotely approaches the power of Tk.

First, a few points:
1) Tk at the moment looks ugly. There is a major
effort undergoing (tile--look on sourceforge) to
develop a themable Tk, and they already have
some very good-looking Windows-looking screenshots.
This won't be available in the immediate future,
but I think it won't be too too far off either.
The Tk community understands that the ugly,
nonstandard look is hurting Tk use.

2) Tkinter is a (relatively) thin layer over
Tk calls. The best way to use it is to build
some functions over it to do what you want
to do, and then reuse those functions.

3) Tkinter does make Tk into an object oriented
paradigm. So as you mention, you can subclass
a Tk widget and then pass in appropriate methods
of that class as functions. However, you often
don't even need to do this. A complex widget is
almost certainly going to be declared as a class
so just do:

class MyWidget(Frame):
def __init__(self)
button1=Button(command=self.foo1)
button2=Button(command=self.foo2)

def foo1(event):...
def foo2(event):...

I can't remember if 'command' is the right option to Button,
but you get the idea.

3) People often complain about the Tk widget set not
being powerful enough. This is nonsense. First, read
through all of the man pages for the Text and Canvas
widgets--nothing else even comes close. (If something
does, please let me know). I've looked at QScintilla,
and it is far less flexible than Text. Then, download
the BLT addon package for Tcl/Tk and read through
its graph widget documentation. As for basic widget
sets, There may be a few widget types missing, but
it is very few, and what is missing can usually
be found in an Python extension (MegaWidgets) or
somewhere else, or coded fairly quickly using Tkinter.

4) The event-handling mechanism in Tk is awesome
It is very easy to specify not just single events,
but also "event sequences"; so, for example, you
can specify that ^X^S (the emacs save command)
saves your files.

5) As I mentioned above, it is often best to put
a nicer wrapper around some of the Tkinter stuff.
For example, here is the way I put things into a
gridded layout:

button = Button(...)
label = Label(...)
subframe = Frame(...)
mywidget = MyWidget(...)

grid([
[button, '-', label],
[subframe, 'x', '^'],
['^', mywidget, '-']
])

Which, using the captalized first letter of each
widget's variable, result in a layout like this:

BBL
S L
SMM
with the middle cell empty. The ^ and - characters
simply indicate that the cell in the previous
row/column should be carred into this cell. This
grid function (not method)
took me about 8 lines to write, and I've
put it up on the Tkinter mailing list hosted on
the Python web site.

Likewise, I'm in the process of writing something
to make event binding easier, and will put that
up when it's done. It will look something like:

bindevents(widget,
ca_x_space_b1=fun1,
m_backspace=fun2,
Y=fun3,
)

Which indicates that fun1 should be invoked on the
event sequence ctrl-alt-x ctrl-alt-space ctrl-mousebutton1;
fun2 on meta-backspace; and fun3 on the single key 'Y'.

There are a few problems with Tk. To use much of the
Tkinter stuff, you need to have the Tk man pages
handy, which is why writing more pythonic wrappers
is a good idea. There is a third-party table widget
available which is useful for relatively simple
applications, but which lacks the flexibility and
power of the Text and Canvas widgets. (Still, it's
better than a lot of other table implementations
I've seen.) However, once you've gotten over the
initial learning curve (which mostly has to do
with learning the Tk side, and isn't really that
bad--Brent Welch and a co-author have a brand new
book out which is just great), you can throw a
powerful UI together in an amzingly short time.

Cheers,
Ken
Jul 18 '05 #50

59 Replies

This discussion thread is closed

Replies have been disabled for this discussion.