Help : Problems in creating a plugin module for python application.

Sindh skodela at my-deja.com
Mon Oct 16 16:39:11 EDT 2000


Hi folks

I am writing an application in python / Tkinter and Pmw. I am planning
to include plugin facility.
I am trying this way currently. It fails saying btnname attribute is not
available and also importing n says no module byname n, where I
planned to use n as a place holder to iterate over the .py plugin files
in ./plugins/ directory.

Code follows.
################################
Plugin loader in the application
#################################
self.pluginb=Pmw.ButtonBox(self.nb.pg_sys,orient='vertical')
for n in os.listdir('plugins'):
    import n
    self.pluginb.add(getattr(n,btnname),command=getattr(n,'mainrun'))


##########
example plugin
#####################
def mainrun():
	print "hello world"

btnname="HelloWorld"
###############################
Any ideas and helpwould be greatly appreciated.

Thanks
sreekant

--
A man needs to sleep for 36 hours a day atleast.


Sent via Deja.com http://www.deja.com/
Before you buy.



More information about the Python-list mailing list