[Tutor] Newbie project, possible?

Magnus Lyckå magnus@thinkware.se
Tue Jun 17 17:36:06 2003


At 20:16 2003-06-17 +0000, Ruben Walston wrote:
>I'm a realatively new commer to the programming world.

You are very welcome. Have fun!

>  Having done some research I found that python was perhaps the best 
> program to begin my programming journey with.

Just wish it had been there when I started. The only problem I
see with Python is that most other programming languages seem
so stupid once you know Python! :)

>In the few months that I've been reading and practicing with python, I've 
>found my biggest obstacle to be that I dont know all of the modules 
>available to me,

This takes time of course. It's typical for for Python that
programmers reach this problem while students of other programming
languages are still struggling with syntax. You should consider
yourself lucky.

The Python Standard Library is very rich, and it's natural that it
takes time to learn it. To a large extent it interfaces Python to other
technologies, such XML or email, and to understand these libraries you
need to understand those technologies. Browsing through the Python
Library Reference Manual now and then might be worthwhile. See
http://www.python.org/doc/current/lib/lib.html and
http://www.python.org/doc/current/lib/modindex.html

>further I'm still trying to figure out exactly how to use classes.

It took me quite a while to figure out the concept of
classes too. I don't know how much simpler it would
have been if I had had Python then...

Classes are basically a building block that allows us to
gather some data and operations we perform on that very data
as one unit in the program.

They might represent nouns in a requirements document that
are more then just simple values, and verbs are candidates
to be methods in a class. The nouns that just represent plain
values might be attributes in a class. Of course, also an
attribute might be an instance of a class.

>Anyway, I've decided to help me along in my study that rather than just 
>read and do the excercises provided by some of the things I'm studying, I 
>figured why not try and program something that I could use at work.

I'm pretty convinced this is a good way to start.

>I work at a hospital and every time a doctor or nurse sees a patient, they 
>have to submit some codes that allows for the hospital to bill the 
>patient. I thought it would be cool to have a little program that would 
>allow them to use a gui

In general, I would suggest that you don't consider a GUI until
your logic is working from command line of from the interactive
Python interpreter. Make the logic as a separate unit, and plug
the GUI onto that. One day, you might want a web UI instead, and
debugging etc is much simpler if you can work with your logic
without regarding user interface issues. Always try to separate
concerns...

Although, in this particular case, it seems that this might be
a rather simple list that we just display values in, and in that
case, there might not be a lot of logic behind the GUI...

>  and type in the treatment that they administered to the patient, and 
> upon there entries the program would search (dictionary?, list?, or 
> tuple?) for the correct code and output the code to a file as well as 
> send the codes to another program.

Interfacing to other programs might be a complex matter, it
depends on what kind of programmatic interface the other program
has... If we're talking about Windows, there might be various
solutions, such as COM, DDE, or by placing the value in the
Windows clipboard, but that might not exactly be newbie stuff...

You'll have to handle that when you get there...

>Does this sound like something a newer user could do or is this a project 
>for someone with more advanced skills?

Don't you think it would be better to let the doctor select
from a list of treatments? It's probably less typing, and they
will be able to browse the list to see what they ar supposed to
type. Roughly how many codes are we talking about. The ideal
solution would look very different for ten, one hundred or one
thousand codes.

Maybe a combination of browsing and searching would be best?

(As an old Unix user, it seems that you only need something
like a small wrapper around something that would be
equivalent to "grep -i '<search term>' <filename>".)

>Well to be honest, I'm going to give it a shot anyway. Question though, by 
>using Tkinter is it possible to have it print text from a module to a screen?

What do you mean by "text from a module"? Of course Tkinter
can be used to display text on the screen. If you can access
that text in your Python code--regardless of Tkinter, you can
display it with Tkinter.

There are also other GUI tool kits than Tkinter. If you feel
that you need a tree widget for instance, wxPython might be a
better fit. It's a much richer toolkit.


--
Magnus Lycka (It's really Lyck&aring;), magnus@thinkware.se
Thinkware AB, Sweden, www.thinkware.se
I code Python ~ The Agile Programming Language