我试图传递一个变量列表, 名为检查功能安装 Func 的支票, 出于某种原因, 它似乎不起作用, 以下是我(认为)相关的代码:
def installFunc(checks):
subprocess.call("md c:MGInstall", shell=True)
subprocess.call (u"net use w: \it01files")
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()
现在,我尝试了几个不同的东西-- 我实际上被堆积堆溢出所给的羊羔部分-- 我有点不明白它是如何运作的。
但我最大的问题是 为什么没有通过支票来安装 Func ()? 我想把完整的支票清单( 像我输入的一样多) 传递给安装 Func () 。