[Tutor] Passing arguments

DORSEY_EDMUND_K@LILLY.COM DORSEY_EDMUND_K@LILLY.COM
Wed Jul 2 12:17:01 2003


This is a multipart message in MIME format.
--=_alternative 0059423305256D57_=
Content-Type: text/plain; charset="us-ascii"

I have a class called GUI which draws my GUI.  I then have another class 
called Calc which does all the calculations.

One of the GUI objects I'm using is a progressMeter (pmw) 

The progressMeter is declared in GUI and it has an update function called 
updateProgress.  So you can have a loop and keep calling updateProgress 
and increment your progress.
This works fine and dandy if I call updateProgress in the GUI class.  The 
problem is I can't monitor the progress in the GUI class because the 
calculation is being done in the Calc class.

Ideally, I want to called updateProgress in the loop of Calc Class.

I thought for a second since python passes stuff by reference I could just 
pass a reference to the progressMeter to Calc and then do the update there 
but that doesn't work.

Do I need to make the progressMeter global?  I read that's not very 
elegant.

How would I go about letting the Calc class update progressMeter.  Thank 
you for your help.

~Ed


--=_alternative 0059423305256D57_=
Content-Type: text/html; charset="us-ascii"


<br><font size=2 face="sans-serif">I have a class called GUI which draws my GUI. &nbsp;I then have another class called Calc which does all the calculations.</font>
<br>
<br><font size=2 face="sans-serif">One of the GUI objects I'm using is a progressMeter (pmw) </font>
<br>
<br><font size=2 face="sans-serif">The progressMeter is declared in GUI and it has an update function called updateProgress. &nbsp;So you can have a loop and keep calling updateProgress and increment your progress.</font>
<br><font size=2 face="sans-serif">This works fine and dandy if I call updateProgress in the GUI class. &nbsp;The problem is I can't monitor the progress in the GUI class because the calculation is being done in the Calc class.</font>
<br>
<br><font size=2 face="sans-serif">Ideally, I want to called updateProgress in the loop of Calc Class.</font>
<br>
<br><font size=2 face="sans-serif">I thought for a second since python passes stuff by reference I could just pass a reference to the progressMeter to Calc and then do the update there but that doesn't work.</font>
<br>
<br><font size=2 face="sans-serif">Do I need to make the progressMeter global? &nbsp;I read that's not very elegant.</font>
<br>
<br><font size=2 face="sans-serif">How would I go about letting the Calc class update progressMeter. &nbsp;Thank you for your help.</font>
<br>
<br><font size=2 face="sans-serif">~Ed</font>
<br>
<br>
--=_alternative 0059423305256D57_=--