[Python-talk] Speaking of oops. How to call a method in another class in another file?
Larry Keber
lakkal at gmail.com
Tue Jul 28 16:46:05 EDT 2009
bruce.labitt at autoliv.com wrote:
>
>
> What if I don't want these defaults, but always want it passed from the
> outside?
> If I comment out the initialization of myfile and myrange it dies.
>
>
I think the filename and range are set in the onOk method of MyForm.
You can take it out of __init__.
So, you'd just have:
if ( plot =="Plot existing"):
p = genwave.Xambig()
p.plotMe(filepath, myrange)
if the "filepath" variable is indeed just the path, and the actual
filename is always "ambig.dat", then make it:
p.plotMe(os.path.join(filepath, "ambig.dat"), myrange)
(that os.path.join() call concatenates 'filepath' and the filename in
the way your OS expects paths to be built - slashes for unixlike,
backslashes for DOS-like)
Larry
>
>>> def plotMe(self, fileName, myRange):
>>> """plot all kinds of stuff"""
>>>
>>> Then
>>>
>>> if ( plot=="Plot existing" ):
>>> p = genwave.Xambig()
>>> p.plotme( myfile, myrange )
>>>
>>>
>>> -Bruce
>>>
>>> <snip>
>>>
>>>
>>>
>>>
>>>> _______________________________________________
>>>> Python-talk mailing list
>>>> Python-talk at dlslug.org
>>>> http://dlslug.org/mailman/listinfo/python-talk
>>>>
>>>>
>>> ******************************
>>> Neither the footer nor anything else in this E-mail is intended to
>>>
>> or constitutes an <br>electronic signature and/or legally binding
>> agreement in the absence of an <br>express statement or Autoliv policy
>> and/or procedure to the contrary.<br>This E-mail and any attachments
>> hereto are Autoliv property and may contain legally <br>privileged,
>> confidential and/or proprietary information.<br>The recipient of this
>> E-mail is prohibited from distributing, copying, forwarding or in any
>> way <br>disseminating any material contained within this E-mail
>> without prior written <br>permission from the author. If you receive
>> this E-mail in error, please <br>immediately notify the author and
>> delete this E-mail. Autoliv disclaims all <br>responsibility and
>> liability for the consequences of any person who fails to <br>abide by
>> the terms herein. <br>
>>
>>> ******************************
>>> _______________________________________________
>>> Python-talk mailing list
>>> Python-talk at dlslug.org
>>> http://dlslug.org/mailman/listinfo/python-talk
>>>
>>>
>> _______________________________________________
>> Python-talk mailing list
>> Python-talk at dlslug.org
>> http://dlslug.org/mailman/listinfo/python-talk
>>
>
>
> ******************************
> Neither the footer nor anything else in this E-mail is intended to or constitutes an <br>electronic signature and/or legally binding agreement in the absence of an <br>express statement or Autoliv policy and/or procedure to the contrary.<br>This E-mail and any attachments hereto are Autoliv property and may contain legally <br>privileged, confidential and/or proprietary information.<br>The recipient of this E-mail is prohibited from distributing, copying, forwarding or in any way <br>disseminating any material contained within this E-mail without prior written <br>permission from the author. If you receive this E-mail in error, please <br>immediately notify the author and delete this E-mail. Autoliv disclaims all <br>responsibility and liability for the consequences of any person who fails to <br>abide by the terms herein. <br>
> ******************************
> _______________________________________________
> Python-talk mailing list
> Python-talk at dlslug.org
> http://dlslug.org/mailman/listinfo/python-talk
>
More information about the Python-talk
mailing list