I am trying to pass along a variable list named checks to the function installFunc, and for some reason it doesn't seem to be working, here's what I (think is) the relevant code:
def installFunc(checks):
subprocess.call("md c:\MGInstall", shell=True)
subprocess.call (u"net use w: \\it01\files")
if checks[0] == 1:
subprocess.call(u"w:\\software\\snagitup.exe")
if checks[1] == 1:
subprocess.call(u"w:\\software\\camtasia.exe")
if checks[2] == 1:
urllib.urlretrieve(u"LONGURL", u"c:\\MGinstall\\gotomeeting.exe")
subprocess.call (u"c:\\MGinstall\\gotomeeting.exe")
if checks[3] == 1:
sixtyfourcheck()
if is64bit == True:
urllib.urlretrieve(u"LONGURL", u"c:\\MGinstall\\tortoiseSVN.exe")
elif is64bit == False:
urllib.urlretrieve(u"LONGURL", u"c:\\MGinstall\\tortoiseSVN.exe")
#urllib.urlretrieve(u"LONGURL", u"c:\\MGinstall\\MGinstall.exe")
#subprocess.call (u"c:\\MGinstall\\MGinstall.exe")
#subprocess.call (u"w:\\printers\\installer\\printer.exe")
app = Tk()
w = Label(app, text="IT Automatic Installer")
w.pack()
text = ["Snagit", "Camtasia", "GotoMeeting", "TortoiseSVN"]
variables = []
for name in text:
variables.append(IntVar())
Checkbutton(text=name, variable=variables[-1]).pack()
checks = [variable.get() for variable in variables]
b = Button(text="Install", command= lambda : installFunc(checks))
b.pack()
app.mainloop()
Now, I've tried a few different things - the lamba portion I was actually given by stack overflow - I am having a little trouble understanding how it works.
But the big problem I am having is - why isn't checks being passed to installFunc()? I want to have the full list of checks (as many items as I put into it) passed to installFunc().