Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

osex.py 1.1 KB

You have to be logged in to leave a comment. Sign In
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
  1. import os
  2. import sys
  3. if sys.platform[0:3] == 'win':
  4. from ctypes import windll
  5. from ctypes import wintypes
  6. def set_process_lowest_prio():
  7. try:
  8. if sys.platform[0:3] == 'win':
  9. GetCurrentProcess = windll.kernel32.GetCurrentProcess
  10. GetCurrentProcess.restype = wintypes.HANDLE
  11. SetPriorityClass = windll.kernel32.SetPriorityClass
  12. SetPriorityClass.argtypes = (wintypes.HANDLE, wintypes.DWORD)
  13. SetPriorityClass ( GetCurrentProcess(), 0x00000040 )
  14. elif 'darwin' in sys.platform:
  15. os.nice(10)
  16. elif 'linux' in sys.platform:
  17. os.nice(20)
  18. except:
  19. print("Unable to set lowest process priority")
  20. def set_process_dpi_aware():
  21. if sys.platform[0:3] == 'win':
  22. windll.user32.SetProcessDPIAware(True)
  23. def get_screen_size():
  24. if sys.platform[0:3] == 'win':
  25. user32 = windll.user32
  26. return user32.GetSystemMetrics(0), user32.GetSystemMetrics(1)
  27. elif 'darwin' in sys.platform:
  28. pass
  29. elif 'linux' in sys.platform:
  30. pass
  31. return (1366, 768)
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...