-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathlauncher.py
47 lines (38 loc) · 2.03 KB
/
launcher.py
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
"""A basic GUI launcher for the various tools in the Canvas Helpers collection."""
__author__ = 'Simon Robinson'
__copyright__ = 'Copyright (c) 2024 Simon Robinson'
__license__ = 'Apache 2.0'
__version__ = '2024-02-21' # ISO 8601 (YYYY-MM-DD)
import subprocess
import tkinter
def launch_tool(name):
print('Tool selected:', name)
subprocess.Popen(['python', '%s.py' % name])
window = tkinter.Tk()
window.title('Canvas Helpers launcher')
tkinter.Button(window, text='Attachment file/comment/mark uploader',
command=lambda: launch_tool('feedbackuploader')).grid(row=0, column=0)
tkinter.Button(window, text='Submission downloader/renamer',
command=lambda: launch_tool('submissiondownloader')).grid(row=0, column=1)
tkinter.Button(window, text='Bulk file uploader',
command=lambda: launch_tool('bulkfileuploader')).grid(row=1, column=0)
tkinter.Button(window, text='Student identifier',
command=lambda: launch_tool('studentidentifier')).grid(row=1, column=1)
tkinter.Button(window, text='Conversation creator',
command=lambda: launch_tool('conversationcreator')).grid(row=2, column=0)
tkinter.Button(window, text='WebPA manager',
command=lambda: launch_tool('webpamanager')).grid(row=2, column=1)
tkinter.Button(window, text='Moderation manager',
command=lambda: launch_tool('moderationmanager')).grid(row=3, column=0)
tkinter.Button(window, text='Quiz result exporter',
command=lambda: launch_tool('quizexporter')).grid(row=3, column=1)
tkinter.Button(window, text='Course cleaner',
command=lambda: launch_tool('coursecleaner')).grid(row=4, column=0)
window_left = (window.winfo_screenwidth() - window.winfo_reqwidth()) / 2
window_top = (window.winfo_screenheight() - window.winfo_reqheight()) / 2
window.geometry('+%d+%d' % (window_left, window_top))
# see: https://stackoverflow.com/questions/1892339/
window.lift()
window.attributes('-topmost', True)
window.after_idle(window.attributes, '-topmost', False)
window.mainloop()