PyGTK vs. wxPython

D

dcrespo

Hi all...

I think wxPython is much better than PyGTK. First of all, PyGTK needs
the GTK runtime installed, whereas wxPython is entirely Python's
modules, so It facilitates the apps' distribution. Also, PyGTK uses
specific controls or widgets of GTK, while wxPython uses native
controls of the platform where the app is running.

I'm learning both, but at a slow step, so I want to know all the
comments about this subject in this group.

I heard about Glade to make the graphic layout of the app and then
export it as XML. Then, it connects to PyGTK. The problem I see is that
What if you want to refer to a state of a specific radiobutton of a
radobutton's group? It seems to be very troublesome.

Please, post any comments about the pros and cons of each library, and
the proper way to construct the graphic layout (generating XML through
Glade, or by hand-code). Thanks.

Daniel
 
G

Grant Edwards

Hi all...

I think wxPython is much better than PyGTK. First of all, PyGTK needs
the GTK runtime installed, whereas wxPython is entirely Python's
modules,

Huh? wxPythonGTK requires GTK runtimes as well:

$ ldd libwx_gtk2_core-2.5.so> /tmp/foo
linux-gate.so.1 => (0xffffe000)
libz.so.1 => /lib/libz.so.1 (0x4028d000)
libdl.so.2 => /lib/libdl.so.2 (0x4029e000)
libgtk-x11-2.0.so.0 => /usr/lib/libgtk-x11-2.0.so.0 (0x402a1000)
libgdk-x11-2.0.so.0 => /usr/lib/libgdk-x11-2.0.so.0 (0x40585000)
libatk-1.0.so.0 => /usr/lib/libatk-1.0.so.0 (0x405fa000)
libgdk_pixbuf-2.0.so.0 => /usr/lib/libgdk_pixbuf-2.0.so.0 (0x40616000)
[...]

If you run wxPython on top of some other toolkit, then you'll
need that toolkit's runtimes instead of GTK.
 
I

Ivan Voras

Grant said:
Huh? wxPythonGTK requires GTK runtimes as well:

He was probably talking about Windows, where wx toolkit uses native
(more or less...) controls.

But then, installing GTK runtime libraries on Windows is a one-click
job, there are automated installers for it.
 
N

Neil Benn

Grant said:
Huh? wxPythonGTK requires GTK runtimes as well:

<snip>
Hello,

Guess he's talking about windows :

http://www.dropline.net/gtk/

You will already have a windowing toolkit on windows - mfc/win32.

BTW, I cheated and saw a windows related question from above also same
poster ;-)

Cheers,

Neil


--

Neil Benn
Senior Automation Engineer
Cenix BioScience
BioInnovations Zentrum
Tatzberg 46
D-01307
Dresden
Germany

Tel : +49 (0)351 4173 154
e-mail : (e-mail address removed)
Cenix Website : http://www.cenix-bioscience.com
 
G

Grant Edwards

He was probably talking about Windows, where wx toolkit uses native
(more or less...) controls.

Ah -- I forgot that GTK was an option under Windows. The last
time I played with PyGTK was a couple years ago and the Win32
port wasn't done yet.
But then, installing GTK runtime libraries on Windows is a
one-click job, there are automated installers for it.

I suppose using native widgets should preserve the look and
feel users are used to.
 
M

Maciej Dziardziel

dcrespo said:
Hi all...

I think wxPython is much better than PyGTK. First of all, PyGTK needs
the GTK runtime installed, whereas wxPython is entirely Python's
modules, so It facilitates the apps' distribution.

As already mentioned, it is not true. You will still need GTK
(on Linux, not on Windows).
Also, PyGTK uses
specific controls or widgets of GTK, while wxPython uses native
controls of the platform where the app is running.

Which has both pros and cons. wx unification isn't perfect (i had some
problems with drawing that required some workarounds specific to a
platform), it also doesn't allow you to really (or at least easy) use
platform specific functionality (GTK app can be easily convert to GNOME
app).
I'm learning both, but at a slow step, so I want to know all the
comments about this subject in this group.

Go to www.pygtk.org, there are many tutorials, faq and other documentation
and try it.
I heard about Glade to make the graphic layout of the app and then
export it as XML. Then, it connects to PyGTK. The problem I see is that
What if you want to refer to a state of a specific radiobutton of a
radobutton's group? It seems to be very troublesome.

Do not listen, just test it. For me glade is the best way to define user
interface. This is the way GUI should be created IMHO. You can access any
widget just by calling its name - you will find details in any glade
tutorial.
Please, post any comments about the pros and cons of each library, and
the proper way to construct the graphic layout (generating XML through
Glade, or by hand-code). Thanks.

I don't have much experience with GTK on Windows, but i really like on
Linux, way more then wx. It works great, is well documented (including
python specific issues) and possible GNOME integration might be great help.
 
S

steve.leach

dcrespo said:
Hi all...

I think wxPython is much better than PyGTK. First of all, PyGTK needs
the GTK runtime installed, whereas wxPython is entirely Python's

And depending on your platform, wxPython also requires GTK installed.

wxWindows is a wrapper for different GUI toolkits. On Windows, it uses
the native API. On Linux, it tries to use GTK but fails to work most of
the time.

wxPython would indeed be a better choice if your applications are only
to run on a certain infamous legacy operating system from the
Pacific Northwest. The PyGTK is a better choice if you are writing for
Linux and want your application to also be able to run on windows.
wxWindows is *extremely* buggy on Linux where it is just a poor wrapper
for the GTK toolkit. In my experience, most supposedly portable multi
platform applications built around wxWindows which are supposed to run
on Linux simply don't run at all. Personally, I have no need to write
for Windows [or any way to test such code]. I know that the GTK toolkit
is available for Windows, and also now for OS X without the need for an
X server.

Just my $0.02
 
D

dcrespo

Hi all... Thank you for your answers...

wxPython, under Linux, tries to use GTK... A better way to say it is:
wxPython uses whatever it needs: under Windows, his API; under Linux,
his API (may imply the use of GTK or GNOME), etc...

Aparently, none of you has tried wxPython recently or properly.
wxPython is a cross-platform toolkit. Currently supported platforms are
32-bit Microsoft Windows, most Unix or unix-like systems, and Macintosh
OS X. Certainly, there may be Linux distributions where it doesn't run
well...
The PyGTK is a better choice if you are writing for
Linux and want your application to also be able to run on windows.

I want exactly the opossite: my apps must be developed for running
primarly under Windows but also be able to run on Linux.

So, tell me PyGTK (with or without Glade/w XML output) or entirely
Python code through wxPython?
Truely, what's the best for CROSS-platform for both Linux and Windows?
Not just for Linux or just for Windows, but for both.

Anyone who had used any a lot?

Thanks

Daniel
 
G

Grant Edwards

Aparently, none of you has tried wxPython recently or properly.

Not so. I'm using it currently and have been using it for a
couple years now.
wxPython is a cross-platform toolkit. Currently supported platforms are
32-bit Microsoft Windows, most Unix or unix-like systems, and Macintosh
OS X. Certainly, there may be Linux distributions where it doesn't run
well...

I've no idea where that idea came from. It runs just fine on
all the Linux distro's I've tried it on.
I want exactly the opossite: my apps must be developed for
running primarly under Windows but also be able to run on
Linux.

So, tell me PyGTK (with or without Glade/w XML output) or
entirely Python code through wxPython? Truely, what's the best
for CROSS-platform for both Linux and Windows? Not just for
Linux or just for Windows, but for both.

Why don't you try them? I've only used PyGTK under Linux, so I
can't vouche for it under Windows. Under Linux it worked fine
for me. I've used wxPython under Linux and deployed on
Windows. Worked fine for me.
 
D

dcrespo

And what did you use for deploying either PyGTK and wxPython? In other
words, what were your workspace and logic of the development?

Thanks

Daniel
 
G

Grant Edwards

And what did you use for deploying either PyGTK and wxPython? In other
words, what were your workspace and logic of the development?

To whom is this question addressed?

I suggest you quote properly when replying in order to give
your question the context required to answer it.
 
G

Grant Edwards

Aaaaaaand: which do you prefer?

Neither particularly. I'm using wxPython because GTK for
windows wasn't ready three years ago when I initially had to
write my first Windows application. If I evaluated both of
them again today, I might choose GTK, and I might not.
 
D

dcrespo

If you see carefully, that question was for you too, because the reply
is at the same level as the one that says "Aaaaaaand: which do you
prefer?" :)

Daniel
 
M

Michael Soulier

Hi all...

I'm learning both, but at a slow step, so I want to know all the
comments about this subject in this group.

Personally, I like pyGTK more because the docs are better. There's
nothing I hate more than trying to use an API that's poorly
documented, and wxPython's is horrid. The API docs are for C++ with an
occasional comment about Python, and the examples are all done with an
obsolete API that has since been updated.

I've found wxPython very frustrating for these reasons, whereas
PyGTK's docs are up-to-date and well done, easy to work with.

Maybe the wxPython people think their docs are good, but likely
they've forgotten how well they already know the API. They need to
take the time to update them.

Mike
 
S

Szabolcs Nagy

it's not quite true since the latest stable release (2.6.0.0)

see the new wx doc (it's generated with epydoc so it's not for C++):
http://www.wxpython.org/docs/api/

i used wxPython with XRCed a few times and i liked the way it works
(worked under linux and win as well for me)

nsz
 
S

Shane Hathaway

Szabolcs said:
it's not quite true since the latest stable release (2.6.0.0)

see the new wx doc (it's generated with epydoc so it's not for C++):
http://www.wxpython.org/docs/api/

i used wxPython with XRCed a few times and i liked the way it works
(worked under linux and win as well for me)

+1. I've had a lot of success with XRCed, but no success with wxGlade.
The UI in XRCed needs polish but it's easy enough to use. Also,
wxGlade wants to spew generated Python code, while XRCed generates a
nice resource file that wx can load easily.

Shane
 
G

Grant Edwards

If you see carefully, that question was for you too, because the reply
is at the same level as the one that says "Aaaaaaand: which do you
prefer?" :)

You're assuming that everybody's newsreader displays things in
the same manner yours does. You're wrong: they don't.
 
D

dcrespo

Correct me if I'm wrong: XRCed doesn't allow to do MDI Parent and Child
frames, but simple apps only.
For what you wouldn't use it? And instead, what would you use instead?
GUI Hand coding?

Daniel
 
S

Szabolcs Nagy

I forgot to mention in my previous post that the best thing in wxPython
is the wxPython demo. It helped me a lot. Browsing through the examples
usually faster than browsing through the api doc.

About XRCed:
I put every static components of the window layout in an xml file with
XRCed
(not static components: buttons moving around, changing labels ...)

Generally my code looks like:

import wx
import wx.xrc

class Frame(wx.Frame):
def __init__(self, parent, resource):
w = resource.LoadFrame(parent, 'FrameName')
self.PostCreate(w)
self.SetIcon(wx.Icon('myapp.ico', wx.BITMAP_TYPE_ICO))

...
#lots of init code here

...
#event handlers here


class App(wx.App):
def OnInit(self):
resource = wx.xrc.XmlResource('myapp.xrc')
self.f = Frame(None, resource)
self.f.Show()
return True

if __name__ == '__main__':
app = App()
app.MainLoop()
 

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

Similar Threads


Members online

Forum statistics

Threads
473,764
Messages
2,569,566
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top