-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
50 lines (38 loc) · 1 KB
/
main.py
File metadata and controls
50 lines (38 loc) · 1 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
import os
import shutil
import ctypes
import tkinter as tk
from tkinter import messagebox
import app
from log import Log
from endprogram import *
# Set workspace
os.chdir(os.path.dirname(os.path.abspath(__file__)))
# Set DIP awereness
ctypes.windll.shcore.SetProcessDpiAwareness(2)
def main():
root = tk.Tk()
root.title("Image clicker")
root.iconbitmap("res/pointer.ico")
root.resizable(False, False)
root.protocol("WM_DELETE_WINDOW", root.quit)
if not os.path.exists("temp"):
os.mkdir("temp")
try:
a = app.App()
a.draw(root)
root.mainloop()
end_of_program()
except Exception as e:
Log.error(f"Error: {e}")
messagebox.showerror("Error", e)
if os.path.exists("temp"):
shutil.rmtree("temp", ignore_errors=False, onerror=None)
if not os.path.exists("log"):
os.mkdir("log")
Log.save_to_file("log/debug.log")
if __name__ == "__main__":
try:
main()
except Exception as e:
print(e)