[Tutor] Joe's learning Tk

Danny Yoo dyoo at hkn.eecs.berkeley.edu
Mon Jul 24 16:42:35 CEST 2006



> Thanks for the great email.I am beginning to see the light on event 
> binding, callbacks and functions. I have attached my program to show my 
> efforts so far. I think I need a some help in application.

Hi Joe,

I haven't seen your message about this on Tutor yet; have you reposted 
your question there?  I'm still a bit busy and haven't had a chance to 
look at this thoroughly; the others on Python-tutor should take a look at 
this.

If I understand your program, it appears to be a mineral or material 
hardness reference program?  It may be nice to organize the data to make 
it easier to extend.  Concretely, it looks like the program is dealing 
with hierarchical data:

     Materials
          Aluminum
               Wrought
               Die Cast
               Sand Cast

          Steel
               Low Carbon
               Medium/High Carbon
               Alloy
          ...

and so keeping this data in a hierarchical data structure seems like a 
useful thing.  Even something simple like:

     { 'Aluminum' : ['Wrought', ...],
       'Steel',   : ['Low Carbon', ...] }

could be a first step in distilling out the interesting data from your 
program into a single place.  At the moment, that knowledge seems spread 
out in the individual GUI elements, and it seems difficult to add more 
information without modifying several parts of the code.



> I seem to be having problems applying things I read. May be I am 
> spending too much time just looking for similar finished programs on the 
> web were I can alter a few things to get results.

It'll take both practice and feedback from others to get more comfortable 
with program design.  Feel free to post your code on the mailing list to 
get feedback.

Good luck!


More information about the Tutor mailing list