> > It would be a god excercise to extract all the p[ipe code into > > a separate class and the GUI methods call those class methods > > to get the work done. THis would allow for a fairly easy port > > to a different GUI or even the creation of a command line > > version, so you could do:
Actually according to the above paragraph, he suggests putting them all in a seperate class. So pseudo-code... class Pipe: All things related to pipe program here. class GUI: def __init__(self): self stuff defined etc. def makeGuiStuff(self): connetion = Pipe(initial variables) make gui stuff here put all button events such as calculate(command = connection.calculate) (I told you it was pseudo-code) HTH, Jacob > You're exactly right setText() is a GUI method. I do have the pipe logic all > mixed up with the GUI code. Now that you point it out, most of my methods > don't have a return statement. They are completely dependant on the GUI > and wouldn't function without it. Virtually all the methods act directly upon > the GUI. > > If I'm understanding you correctly, I should have methods more along the > lines of this one (which is in my code now): > > def volCalc(self, ID, length): > """Calculates the volume/gallons of water inside of > the various pipe. > """ > from math import pi > gal = ((ID*.5)**2)*pi*(12*length)/(230.9429931) > return gal > > It does it's 'job', return a result and is not effected by the GUI at all. I > guess you could actually import this function into the interpreter and use it > without problems. But if you tried doing that with the other function above > (galCalc()) it wouldn't work out quite so well.... > > I'll have to see what I can do to take a step in this direction. It might take > my a little while :-) > > Thank you for your help! > > Bill > > > > > > > > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor > > _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor