[Tutor] Re: Newbie project, possible?

Andrei project5@redrival.net
Tue Jun 17 22:20:40 2003


Ruben Walston wrote:
> research I found that python was perhaps the best program to begin my 
> programming journey with. In the few months that I've been reading and

I think it's a good choice. I learned programming with Pascal which is a 
  traditional teaching language, but I find Python easier on the eye, 
mind and soul.

> practicing with python, I've found my biggest obstacle to be that I dont 
> know all of the modules available to me, further I'm still trying to 

My main platform is Windows and there I use the ActiveState distro of 
Python, which includes an excellent HTMLHelp reference. You can browse 
through it easily with the treeview or use the search features. I also 
combine this with PyCrust (comes with wxPython), which IMO is the best 
way to explore modules you don't know yet (beats reading docs).

> figure out exactly how to use classes. Anyway, I've decided to help me 

Whenever you find you're writing lots of loose functions to manipulate a 
single item, you might be better off writing a class which encorporates 
all those functions as methods of that item. I don't think there are any 
situations where you can't get by without object oriented programming 
(using classes), it's just that IMO OOP makes work and maintenace easier.

> would be cool to have a little program that would allow them to use a 
> gui and type in the treatment that they administered to the patient, and 
> upon there entries the program would search (dictionary?, list?, or 

I'm a fan of the auto-complete system used in browsers, where you can 
press Enter at any time to accept the auto-completion OR browse your way 
to the similar entries provided in a listbox below the text entry box. 
It's very easy to use (unlike say regexes).

> send the codes to another program. Does this sound like something a 
> newer user could do or is this a project for someone with more advanced 

Sounds doable to me, though it could become a lot more difficult if you 
have extremely large numbers of treatments, or communications with other 
apps prove a problem.

> skills? 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 

You might want to look into wxPython, it has some really nice free GUI 
painters (my personal fav is wxGlade, but Boa is very good too) and IMO 
it looks better too.

I think you should go with Magnus' advice about separating GUI and 
engine at a code level (I once ended up rewriting a program where I 
hadn't done this because it had become unmaintainable), but I for one 
don't write engine first, GUI second and I also don't often (or ever) 
use the engine from the command line. The GUI helps me think of what 
functions the engine should provide and it also provides a VERY fast way 
of testing my engine (why type a lot when I can press F2 from my GUI?). 
That being said, my largest Python program is only some 2000 lines, 400 
of which are generated by wxGlade, so larger projects might not work 
like that.

Andrei

=====
Mail address in header catches spam. Real contact info (decode with rot13):
cebwrpg5@bcrenznvy.pbz. Fcnz-serr! Cyrnfr qb abg hfr va choyvp cbfgf. V 
ernq gur yvfg, fb gurer'f ab arrq gb PP.