First Impressions of Linux GUI Programming

R

R.Marquez

I hope I don't bore you with this personal experience. But, I hope
the details are helpful for other Python and/or Linux newbies, or for
those thinking about becoming such.

I have been using Python on Windows for a few years now. One of the
things that attracted me to Python was the fact that it offered the
possibility of learning to program in Linux wile not even using Linux.
I recognized a few years back that Linux would eventually be the
platform I would use, once it matured a little.

My first Python GUI toolkit to learn was wxPython, and I have nothing
but good things to say about it. But, after a while I began looking
for an ide to avoid some of the tedious aspects of coding the GUI. I
am still not completely settled on any one of them, but for some small
utilities that I've written I have enjoyed using PythonCard the best.
I have also heard great things about PyQt, however I have been
discouraged to try it since, on Windows, there is no GPL version (I
think that is a mistake on Trolltech's part, but that is another
issue).

I recently received a copy of Mandrake 9.2 (included in the December
2003 issue of Linux Format magazine), so I decided to install it on a
test machine. Everything went smooth and it looks beautiful. It
comes with Python 2.3 already installed. I had a few minutes to
spare, so I decided to take a quick look at PyQt. I downloaded the
following rpms:

PyKDE-3.7-1mdk92.i586.rpm, PyQt-3.7-1mdk92.i586.rpm,
PyQt-devel-3.7-1mdk92.i586.rpm, libqscintilla2-1.1-1mdksbe.i586.rpm,
libqscintilla2-devel-1.1-1mdksbe.i586.rpm,
libsip10-3.7-mdk92.i586.rpm, libsip10-devel-3.7-mdk92.i586.rpm,
sip-3.7-mdk92.i586.rpm

As I said I only had a few minutes to spare. So when I ran into
trouble I did not take the time to chase to far for a solution. (I
thought things had installed well but Python would not find qt). As a
last resort I tried building PyQt from source, but it complained about
not finding Python.h. That led me to a post in C.L.P. that mentioned
that to install PyQt in Mandrake it was recommended to install a
separate copy of Python to use instead of the one shipped. My test
machine has a small (3GB) hard drive, so I decided to postpone that.

Having done that, I decided to try wxPython. I went to the site and
downloaded the rpm. Once downloaded, I simply right-clicked on it,
selected "Open with ...", and chose "Software Installer". It went in
without a hitch. I opened a terminal session to run Python, imported
wx, and it worked. I even tried coding a little wxPython YES_NO
dialog window, and there it was.

Encouraged by that success I downloaded the latest PythonCard rpm for
Mandrake. Again, it installed as smooth as wxPython did. It even
placed links for the Code and Resource Editors on the K menu. They
both worked well. I quickly copied one of my little PythonCard
programs from Windows. I used "Open With" to open the script in the
PythonCard Editor. I removed a couple of Windows specific calls,
saved it, and launched it. Wow, there it was. I was now Linux
programmer. Well, sort of :).

Now, if I could only figure out a way to interact with my utility from
Konqueror or Nautilus, as the "Send to" feature of Windows Explorer
allows, I will be even happier. ;) Thanks to all you coders that have
given us such great tools under such liberal licenses.
 
S

Stephen Boulet

R.Marquez said:
Now, if I could only figure out a way to interact with my utility from
Konqueror or Nautilus, as the "Send to" feature of Windows Explorer
allows, I will be even happier. ;) Thanks to all you coders that have
given us such great tools under such liberal licenses.

Under Konqueror go under settings. You can map your file associations,
and have multiple associations for a file type. Type in "py" as file type.

Stephen
 
G

GrayGeek

R.Marquez said:
I hope I don't bore you with this personal experience. But, I hope
the details are helpful for other Python and/or Linux newbies, or for
those thinking about becoming such.

I have been using Python on Windows for a few years now. One of the
things that attracted me to Python was the fact that it offered the
possibility of learning to program in Linux wile not even using Linux.
I recognized a few years back that Linux would eventually be the
platform I would use, once it matured a little.

My first Python GUI toolkit to learn was wxPython, and I have nothing
but good things to say about it. But, after a while I began looking
for an ide to avoid some of the tedious aspects of coding the GUI. I
am still not completely settled on any one of them, but for some small
utilities that I've written I have enjoyed using PythonCard the best.
I have also heard great things about PyQt, however I have been
discouraged to try it since, on Windows, there is no GPL version (I
think that is a mistake on Trolltech's part, but that is another
issue).

I recently received a copy of Mandrake 9.2 (included in the December
2003 issue of Linux Format magazine), so I decided to install it on a
test machine. Everything went smooth and it looks beautiful. It
comes with Python 2.3 already installed. I had a few minutes to
spare, so I decided to take a quick look at PyQt. I downloaded the
following rpms:

Isn't Linux Format a hoot! I really love the DVD (or 2 CDs) that come with
every issue. I find the articles are first class and delve into specifics
for apps, utilities, distros, what ever. I've subscribed to Linux Journal
for years, but compared to Linux Format LJ is hollow.

BTW, Have you tried Boa-Constructor, a GUI RAD dev tool that uses wxPython?
 
R

R.Marquez

GrayGeek said:
Isn't Linux Format a hoot! I really love the DVD (or 2 CDs) that come with
every issue. I find the articles are first class and delve into specifics
for apps, utilities, distros, what ever. I've subscribed to Linux Journal
for years, but compared to Linux Format LJ is hollow.

Yes. Linux Format is outstanding (a little pricey, but I figured I
would try it for a year). I have enjoyed it tremendously. I sense a
good interest on their part in really geting a good quality product
out, including the DVD/CDs that they include. The forums on their
website is also a nice complement.
BTW, Have you tried Boa-Constructor, a GUI RAD dev tool that uses wxPython?

I gave it a quick test. But, it was a little too complex for me at the
time. From what I could see, I would have had to learn a particular
way of organizing my code so that Boa could work with it. For
example, it seemed to want me to have a main() method in every app.
That may be Ok, but I didn't feel like taking the time to learn that
at the time. I also didn't like how it would spray code into my app
as I added GUI components. It reminded me of what I felt the first
time I used MS Front Page to edit some of my web pages (shudder :).
But, I've heard that efforts are on the way to improve some of that.
So, I may give it another try some time.

On the other hand, when I then tried PythonCard, I was immediately
sold on its simplicity, clarity of code, and elegant separation of the
GUI code from the rest of the application. Have you tried Python
Card?
 
R

R.Marquez

Now, if I could only figure out a way to interact with my utility from
Under Konqueror go under settings. You can map your file associations,
and have multiple associations for a file type. Type in "py" as file type.

Stephen,
What I mean is that, in Windows Explorer, I am able to select a few
arbitrary files and/or directories, right click on them and send them
to an app as parameters. That way, the app could perform a certain
job on each one of the selected files. I've now heard that I'll have
to wait until KDE 3.2 comes out to be able to do this, since it will
allow one to define custom context menu
entries. I just hope that I will be able to easily write them through
Python. (I wonder if GNOME will have something similar.)
 
T

Tim(PAS)

PÃ¥ 13 Nov 2003 12:32:10 -0800 said:
I gave it a quick test. But, it was a little too complex for me at the
time. From what I could see, I would have had to learn a particular
way of organizing my code so that Boa could work with it. For
example, it seemed to want me to have a main() method in every app. That
may be Ok, but I didn't feel like taking the time to learn that
at the time. I also didn't like how it would spray code into my app
as I added GUI components. It reminded me of what I felt the first
time I used MS Front Page to edit some of my web pages (shudder :). But,
I've heard that efforts are on the way to improve some of that. So, I may
give it another try some time.

On the other hand, when I then tried PythonCard, I was immediately
sold on its simplicity, clarity of code, and elegant separation of the
GUI code from the rest of the application. Have you tried Python
Card?

You could also check out the FLTK GUI toolkit with the pyFLTK wrapper. FLTK
comes with a nice and easy GUI builder and the pyFLTK tool flconvert
converts it to python code.

Check it out on:

FLTK: http://www.fltk.org/
pyfltk: http://pyfltk.sourceforge.net/index.html

Best regards
Tim R.
 
G

GrayGeek

R.Marquez said:
Yes. Linux Format is outstanding (a little pricey, but I figured I
would try it for a year). I have enjoyed it tremendously. I sense a
good interest on their part in really geting a good quality product
out, including the DVD/CDs that they include. The forums on their
website is also a nice complement.

I gave it a quick test. But, it was a little too complex for me at the
time. From what I could see, I would have had to learn a particular
way of organizing my code so that Boa could work with it. For
example, it seemed to want me to have a main() method in every app.
That may be Ok, but I didn't feel like taking the time to learn that
at the time. I also didn't like how it would spray code into my app
as I added GUI components. It reminded me of what I felt the first
time I used MS Front Page to edit some of my web pages (shudder :).
But, I've heard that efforts are on the way to improve some of that.
So, I may give it another try some time.

On the other hand, when I then tried PythonCard, I was immediately
sold on its simplicity, clarity of code, and elegant separation of the
GUI code from the rest of the application. Have you tried Python
Card?

I've downloaded it but haven't installed it. Boa-Constructor is easy IF
you've had experience with other GUI RAD Dev tools like VB, KDevelop,
Kylix, etc., otherwise the learning curve can be steep.
 
J

John J. Lee

What I mean is that, in Windows Explorer, I am able to select a few
arbitrary files and/or directories, right click on them and send them
to an app as parameters. That way, the app could perform a certain
job on each one of the selected files. I've now heard that I'll have
to wait until KDE 3.2 comes out to be able to do this, since it will
allow one to define custom context menu
[...]

I never use Konqueror as a file browser, only as a web browser, but
I'm already running 3.2 and it's not particularly unstable. I've had
a few more crashes of Konqueror than with 3.0, but that's all.

It's easy to compile, and once you check out of CVS with cvsup (no,
not "cvs up", "cvsup" is a file syncing app that takes advantage of
CVS amongst other protocols), you can easily update to the final
release when it comes out. Just follow the KDE cvsup instructions
(google for them), with the modifications that:

1. You have to click the little green arrow in cvsup to start the
thing downloading. I failed to notice that :)

2. There are a few more i18n modules added since the KDE cvsup page
was written, so you need them in the file that tells cvsup which
i18n modules not to download (and you need to read the cvsup FAQ to
figure out where to put that file)

3. Remember to compile in the order: arts, kdelibs, kdebase, then
anything else.

4. If you don't know how your kdm / xdm / gdm configuration works,
that can admittedly be a major pain.


John
 
D

David Boddie

What I mean is that, in Windows Explorer, I am able to select a few
arbitrary files and/or directories, right click on them and send them
to an app as parameters. That way, the app could perform a certain
job on each one of the selected files. I've now heard that I'll have
to wait until KDE 3.2 comes out to be able to do this, since it will
allow one to define custom context menu
entries. I just hope that I will be able to easily write them through
Python. (I wonder if GNOME will have something similar.)

Is the following URL at all helpful or is the interface too inflexible?

http://developer.kde.org/documentation/tutorials/dot/servicemenus.html

David
 
R

R.Marquez

Is the following URL at all helpful or is the interface too inflexible?

http://developer.kde.org/documentation/tutorials/dot/servicemenus.html

David

Wow! That works very well.

In Windows, there is a limmitation on the "Send to" functionality that
only allows about 512 characters to be passed on. So if the file path
is deep or if there are a lot of files, Windows complains with a (very
misleading) error.

However, in KDE I configured a Service Menu for one of my little
utilities that accepts files and directories as parameters, and I was
able to pass 1569 items to it without a problem. I love it! Thank
you very much for the tip.
 
M

Mark Roach

What I mean is that, in Windows Explorer, I am able to select a few
arbitrary files and/or directories, right click on them and send them
to an app as parameters. That way, the app could perform a certain
job on each one of the selected files. I've now heard that I'll have
to wait until KDE 3.2 comes out to be able to do this, since it will
allow one to define custom context menu
entries. I just hope that I will be able to easily write them through
Python. (I wonder if GNOME will have something similar.)

Here is a trivial example of having a context menu item for a specific
content type in nautilus (using python)...
http://okmaybe.com:8000/~mrroach/edit-directory-listing.zip

-Mark
 

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,994
Messages
2,570,223
Members
46,815
Latest member
treekmostly22

Latest Threads

Top