Start New Discussion within our Software Development Community

i have had a busy day and its late in the uk?
I have with a little help earlier on here combined lots of snippets orf old code and tutorials into a app that works and is all new code.

problem I have run into is that I want to right a method that generates buttons on a wxPython application. the buttons are supposed to run the same function which basically launches the application using os.system(various app)
i can traverse the apps folder and get all the apps, i can generate the buttons and the binds.

when teh script runs the apps all launch automatically.!
what i need help with is apparently the bind and function def

for appPath, app in ga.getApps():
			box.Add(wx.Button(lPanel,count+10,app),0,wx.EXPAND)
			self.Bind(wx.EVT_BUTTON,self.OnRun(appPath),id=count+10)
#third line binds to button and trie sto pass teh appPath to the function OnRun

On Run for example print is for debug reasons only.
unsure as to variables in def line self,event,variable or something else ? i know from error it takes self no matter what!

def OnRun(event,appPath):
		print appPath
		os.system('.'+appPath)

I cant seem to find this as a subject in tutorials if any body as one please point me at it?

i have used a global list to in what i consider a hack to over come this if any one ha a graceful solution let me know.

This question has already been answered. Start a new discussion instead.