[Tutor] Tutor Digest, Vol 29, Issue 68

János Juhász janos.juhasz at VELUX.com
Thu Jul 27 08:00:36 CEST 2006


Dear Alan,

> I'm confused...

> #################
> #This should be the complete file
> def OnMenuFindMe():
> print 'You found me'

> f = getattr(What_Should_It_Be???, 'OnMenuFindMe')

> f()
> #################

> You are trying to get a reference to a function in the same
> file and whose name you know? So why not just

> f = OnMenuFindMe
> f()

> Or just call the function!
> getattr makes sense when its another module or a class
> where you may not have access to the function somehow
> but it doesn't make much sense in this case - at least
> not to me!

> Alan G.

I just making a small script to manipulate visio object attributes in my 
network documentation via com,
colouring the PCs based on the HDD free space or memory size, owner 
department ..., labelling with computername or assetnumber.
It works now from Python prompt. I just wanted to put this functionality 
into a small wxpython application and building up the menus like 
pythoncard. So, when there was a functionname like OnMenuShowAssetNumber, 
I would append a new menuitem with ShowAssetNumber.



Yours sincerely, 
______________________________
Janos Juhasz 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20060727/15aad7bf/attachment.html 


More information about the Tutor mailing list