All pastes #987093 Raw Edit

Stuff

public python v1 · immutable
·published 2008-04-16 06:24 UTC
rendered paste body
# App Loader Manager -from Tkinter import *import pickle, tkFileDialog, os# Set up the main windowroot = Tk()root.geometry("600x400")root.title("App Loader")# Functionsdef PickApp():	filename = tkFileDialog.askopenfilename()	applist.insert(END, filename)def RemoveApp():	applist.delete(ANCHOR)	def Save():	f = file("appsload.db", "wb")	apps = applist.get(0, END)	pickle.dump(apps, f)def Enable():	batcontents = os.getcwd()+"\\apploader.exe"	out_file = open("C:/Documents and Settings/All Users/Start Menu/Programs/Startup/AppLoader.bat", "w")	out_file.write(batcontents)	out_file.close()	def Disable():	try:		os.path.exists("C:/Documents and Settings/All Users/Start Menu/Programs/Startup/AppLoader.bat") and os.path.isfile("C:/Documents and Settings/All Users/Start Menu/Programs/Startup/AppLoader.bat")		os.remove("C:/Documents and Settings/All Users/Start Menu/Programs/Startup/AppLoader.bat")	except:		passdef DeleteCurrent(event):	Remove()# Set up the interfacetextframe = Frame(root)listframe = Frame(root)pickapp_button = Button(textframe, text="Pick App", command = PickApp)removeapp_button = Button(textframe, text="Remove App", command = RemoveApp)save_button = Button(textframe, text="Save", command = Save)enable_button = Button(textframe, text="Enable", command = Enable)disable_button = Button(textframe, text="Disable", command = Disable)scrollbar = Scrollbar(listframe, orient=VERTICAL)applist = Listbox(listframe, yscrollcommand=scrollbar.set, selectmode=EXTENDED)scrollbar.configure(command=applist.yview)# Bind keyboard/mouse events to actionsapplist.bind("<Double-Button-3>", DeleteCurrent)# Populate the windowpickapp_button.pack(side=LEFT)removeapp_button.pack(side=LEFT)save_button.pack(side=LEFT)enable_button.pack(side=LEFT)disable_button.pack(side=LEFT)applist.pack(side=LEFT,fill=BOTH, expand=1)scrollbar.pack(side=RIGHT, fill=Y)textframe.pack(fill=X)listframe.pack(fill=BOTH, expand=1)# Try loading the current app listtry:	f = file("appsload.db", "rb")	apps = pickle.load(f)	for item in apps:		applist.insert(END, item)		f.close()except:	pass# Run the programroot.mainloop()# App Loaderimport os, pickletry:	f = file("appsload.db", "rb")	apps = pickle.load(f)        f.close()	for item in apps:		os.startfile(item)except:	pass