How to get started in GUI Programming?

2005-11-25 Thread peter . mosley
I am trying to learn GUI programming in Python, but have to confess I
am finding it difficult.

I am not an experienced programmer - just someone who from time to
time writes small programs for my use.  Over the years I have moved
from GWBASIC to QBASIC to Visual Basic, and now trying to move across
to a Linux platform.  Python seems to be the best compromise between
the limitations of command line basic programming and the total
incomprehensibility of C.

Googling around it seems the best GUI is either Tkinter or PyGtk.  I
found a book which recommended PyGtk, as it had a graphical design
option,  Glade.  Coming from a VB background I latched onto that and
bought the book (Beginning Python, Wrox), but it was a disappointment
(or more accurately a complete waste of money) - there was
insufficient detail in the text.

I've found the tutorial and reference manual on the PyGtk web site,
but although I've made some progress, I keep reaching points where I
have insufficient background to understand them. Currently I'm stuck
on dialog boxes (the code seems immensely complex for the equivalent of
  MsgBox("Do you really want to do this ",vbYesNo) and I haven't
got it to work properly yet) and loading graphical images in anything
other than their original size, but every new step brings another
struggle

I've seen reference to a Tkinter book - something like 'Python
and Tkinter Programming' but it seems to be out of print and
unavailable.

Can anyone offer any suggestions as to the least painful way forwards?

(Email address was valid once but has long since been abandoned to
spam. Please rely via newsgroup)

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


Re: How to get started in GUI Programming?

2005-11-28 Thread peter . mosley
A big thank you to all who responded.  There are too many to reply
individually, but to summarise ...

Thomas Güttler gave a link to an example program, editMetadata.py
which uses yes no dialogs and scaled images.  I've not yet tried to
learn from this, but looking at the code it seems to provide exactly
what I am looking for.  It uses the gtkMessageDialog class, which I
hadn't come across (the tutorial doesn't seem to mention it?)

Others recommended wxPython, PyQt and various derivatives.  The trouble
is there's too much choice!  But my experience is that under Linux
nothing ever works out of the box, and so I am reluctant to invite more
grief by installing fresh packages until I am sure those already
installed are not adequate.

Easygui had some supporters. I had already come across this, and while
I agree it is a delightfully simple tool to use, and ideal for i/o
operations, it is not sufficiently flexible for my needs.

One development is that my local public library has, to my surprise,
managed to locate a copy of 'Python and Tkinter Programming' by J.
Grayson.  I've not read it yet, and an initial flick through
doesn't look too promising but maybe I am mistaken..  I acknowledge
that Tkinter is a bit dated, and may not have a native 'look and
feel', but for me this would be outweighed by an accessible textbook.

So currently the choice is between continuing with PyGtk, using the
editMetadata.py code as a model, or Tkinter using Grayson's book.
I'll try both and see which is more successful.

Once again thank you to all who responded.

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


Unable to install Python Imaging Library

2005-12-18 Thread peter . mosley
A few weeks ago I asked for advice about which GUI toolkit I should
learn, and receved several helpful answers.  In the end I went with
Tkinter.  This was because a) it was already installed on the machines
I am most likley to use, b) it is cross platform, and c) it was not as
complex as PyGtk - which I tried and was totally unable to decipher.

I am now at the point of trying to import the Python Imaging Library,
and I have reached a total standstill.  I downloaded a copy of Python
Imaging Library 1.1.5 Source Kit from the site
http://www.pythonware.com/products/pil/. There did not seem to be any
prebuilt binaries suitable for my system (Python 2.2/Fedora Core 1), so
I loaded the source code.

The instructions said to try 'python setup.py install', followed by
more detailed instructions 'If you prefer to know what you're doing'. I
do prefer to know what I'm doing, but couldn't understand the following
instructions.  So I tried the simple route, but it failed with the
output shown below.

I have absolutely no idea how to proceed.  Can anyone point me in the
right direction to get over this hurdle?


gcc -DNDEBUG -O2 -g -pipe -march=i386 -mcpu=i686 -D_GNU_SOURCE -fPIC
-fPIC -I/usr/include/freetype2 -IlibImaging -I/usr/include
-I/usr/local/include -I/usr/include/python2.2 -c _imagingtk.c -o
build/temp.linux-i686-2.2/_imagingtk.o
_imagingtk.c:20:16: tk.h: No such file or directory
_imagingtk.c:23: error: syntax error before '*' token
_imagingtk.c:31: error: syntax error before "Tcl_Interp"
_imagingtk.c:31: warning: no semicolon at end of struct or union
_imagingtk.c:32: warning: data definition has no type or storage class
_imagingtk.c: In function `_tkinit':
_imagingtk.c:37: error: `Tcl_Interp' undeclared (first use in this
function)
_imagingtk.c:37: error: (Each undeclared identifier is reported only
once
_imagingtk.c:37: error: for each function it appears in.)
_imagingtk.c:37: error: `interp' undeclared (first use in this
function)
_imagingtk.c:45: error: syntax error before ')' token
_imagingtk.c:50: error: `app' undeclared (first use in this function)
_imagingtk.c:50: error: syntax error before ')' token
_imagingtk.c: At top level:
_imagingtk.c:55: warning: parameter names (without types) in function
declaration
_imagingtk.c:55: error: conflicting types for `TkImaging_Init'
_imagingtk.c:23: error: previous declaration of `TkImaging_Init'
_imagingtk.c:55: warning: data definition has no type or storage class
_imagingtk.c:57: error: syntax error before '&' token
error: command 'gcc' failed with exit status 1

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


Re: Unable to install Python Imaging Library

2005-12-20 Thread peter . mosley
Thanks for that reply.

I hadn't tried installing the Tcl and Tk development libraries -
because I had no idea these that these were necessary (or that they
even existed!).  My first attempt to do so was a total failure, as I
downloaded the RPM files from http://rpmfind.net, but immediately
entered a dependency hell.  My next attempt was a little more thought
out - I looked for the appropriate files on some Fedora Core 1
distribution discs, and to my surprise found them.  To my even greater
surprise, I could load these without problems and then the PIL install
ran smoothly.

So thanks to your hint I have got there. Much appreciated.

Peter

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


Unable to get PIL to load jpeg images

2006-02-06 Thread peter . mosley
Hello again

I'm still wrestling with Python / Tkinter / PIL.  I have almost got it
to work - on a Fedora Core 1 system I can now display images in a
Tkinter window.  But I also run a Fedora Core 3 system, and when I
tried the same procedures I get the following errors:-

[EMAIL PROTECTED] jpgTest]$ python pil_jpg.py
Exception in Tkinter callback
Traceback (most recent call last):
  File "/usr/lib/python2.3/lib-tk/Tkinter.py", line 1345, in __call__
return self.func(*args)
  File "pil_jpg.py", line 26, in do_something
a.thumbnail((200,150))
  File "/usr/lib/python2.3/site-packages/PIL/Image.py", line 1422, in
thumbnail
self.load()
  File "/usr/lib/python2.3/site-packages/PIL/ImageFile.py", line 180,
in load
d = Image._getdecoder(self.mode, d, a, self.decoderconfig)
  File "/usr/lib/python2.3/site-packages/PIL/Image.py", line 328, in
_getdecoder
raise IOError("decoder %s not available" % decoder_name)
IOError: decoder jpeg not available

I am running Python 2.3.4, PIL 1.1.5 on a Fedora Core 3 system.  I know
the code is ok, as it runs quite happily under FC1 and Windows.  I've
searched around for clues, and found a few references to this error
message, but quite frankly don't understand what they are saying.

Searching around for files that look as if they may be the jpeg
libraries I can find
/usr/lib/libjpeg.so.62.0.0, and a symbolic link /usr/lib/libjpeg.so.62.
 I think I somehow have to configure PIL to recognise these, but I am
not sure and anyway don't know how to do this.

Can anyone help?

Peter

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


Re: Unable to get PIL to load jpeg images

2006-02-07 Thread peter . mosley
Someone out there must surely know - please!

Peter

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


Re: Unable to get PIL to load jpeg images

2006-02-09 Thread peter . mosley

Thanks for that tip

Following a dialogue in that discussion group it is now working.  The
problem was that I didn't have the right jpeg library installed
(although what I had was enough to show jpegs in gThumb, GIMP and the
Gnome and KDE desktops so I don't understand why it wasn't). I had to
also install a jpeg development library, which fortunately was
available on my Fedora Core 3 installation disc.

A final glitch was that the previous broken build interfered with the
linking of PIL to the libraries.  I went for overkill, and deleted all
the PIL installation and site-packages directories, then reinstalled
from the original tarball.  This gave a curious glitch, in that the
first time I ran it it failed to load Tkinter with some obscure error
message, but on a retry everything was fine.  This worries me slightly,
as I don't know what happened and there is always a chance it could
happen again, but until it does I can't investigate it.

Slightly off topic, but I think my experience here is typical of any
installation on a Linux system, and illustrates why, despite huge
improvements over the last few years, Linux is not yet really suitable
for non expert use.

Thanks to everyone who's helped me over the last few months.

Peter

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


Re: Unable to get PIL to load jpeg images

2006-02-17 Thread peter . mosley
> Can you share the name of the library on the Fedora distro?


file:///media/cdrecorder/Fedora/RPMS/libjpeg-devel-6b-33.i386.rpm

On disc 3 in my copy, but that probably doesn't mean anything!

Peter

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


Re: Write a GUI for a python script?

2006-03-03 Thread peter . mosley
Hi

I, too, am a python newbie and have wrestled with GUI programming.  I
think I am winning, but its been a struggle.

>From what I have gleaned, there are three and a half options.  The half
is easygui - see http://www.ferg.org/easygui - which allows you to
place pop up dialogues in procedural code.  Apart from that there's
Tkinter, PyGtk and wxPython.  I never tried wxPython as it wasn't
installed on my system.  I struggled with PyGtk (http://www.pygtk.org/)
and eventually gave up - somehow I could never get to work any code
which wasn't an exact copy of the tutorial.  Which leaves Tkinter, and
here, with the help of Frederik Lundh's tutorial and manual
(http://www.pythonware.com/library/tkinter/introduction/) , I have been
able to get results.  Not perfect - if you search you'll find a number
of my posts on this newsgroup when I was stuck, and the manual is
incomplete (why - given that Tkinter is the de facto standard?). But
for me at least Tkinter provided a way forwards.

Good Luck

Peter

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


Re: GUI in python

2006-03-30 Thread peter . mosley
See this thread

http://groups.google.co.uk/group/comp.lang.python/browse_thread/thread/989b957f244d48e0/429378d911ba4357?hl=en#429378d911ba4357


Peter

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