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

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to