-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
68 lines (47 loc) · 1.6 KB
/
app.py
File metadata and controls
68 lines (47 loc) · 1.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
import tkinter as tk
from tkinter import filedialog, Text
import os
apps = []
if os.path.isfile("save.txt"):
with open("save.txt", "r") as fileRef:
tempApps = fileRef.read()
tempApps = tempApps.split(",")
apps = [x for x in tempApps if x.strip()]
def updateList():
for widget in frame.winfo_children():
widget.destroy()
for app in apps:
label = tk.Label(frame, text=app, bg="gray")
label.pack()
def addApp():
updateList()
fileName = filedialog.askopenfilename(initialdir="/", title="Select file",
filetypes=(("executables", "*.exe"), ("all files", "*.*")))
apps.append(fileName)
updateList()
def runApp():
for app in apps:
os.startfile(app)
def delApp():
apps.clear()
updateList()
root = tk.Tk()
root.title("Ease Application")
canvas = tk.Canvas(root, height="600", width="600", bg="#74C4AE")
canvas.pack()
frame = tk.Frame(root, bg="white")
frame.place(relwidth="0.8", relheight="0.7", relx="0.1", rely="0.1")
updateList()
openFile = tk.Button(root, text="Open File", padx=10, pady=5,
fg="white", bg="#3381ff", command=addApp)
openFile.pack(fill=tk.X)
runApps = tk.Button(root, text="Run Apps", padx=10,
pady=5, fg="white", bg="#3381ff", command=runApp)
runApps.pack(fill=tk.X)
delApps = tk.Button(root, text="Clear saved list", padx=10,
pady=5, fg="white", bg="red", command=delApp)
delApps.pack(fill=tk.X)
root.mainloop()
with open("save.txt", "w") as fileRef:
for app in apps:
fileRef.write(app + ",")