-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
33 lines (27 loc) · 1003 Bytes
/
main.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
from logo import show_splash_screen
from net_monitor import NetMonitorApp
import tkinter as tk
import psutil
import sys
def close_old_instance():
"""إغلاق النسخة القديمة من التطبيق إذا كانت تعمل."""
for proc in psutil.process_iter():
if proc.name() == 'main.exe':
proc.terminate() # إنهاء العملية
proc.wait() # الانتظار حتى يتم إنهاء العملية
def is_running():
for proc in psutil.process_iter(attrs=['pid', 'name']):
if proc.info['name'] == 'main.exe': # اسم ملف التنفيذ
return True
return False
def main():
# if is_running():
# # print("NetMonitor is already running. Closing the old instance.")
# close_old_instance()
# sys.exit(0)
show_splash_screen() # عرض النافذة الترحيبية
root = tk.Tk()
app = NetMonitorApp(root)
root.mainloop()
if __name__ == "__main__":
main()