-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathutil.py
More file actions
40 lines (34 loc) · 1.15 KB
/
util.py
File metadata and controls
40 lines (34 loc) · 1.15 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
import os
from datetime import datetime
import platform
import re, uuid
import socket
from tkinter import *
import pyautogui
import cv2
import numpy as np
import getmac
class Util:
def __init__(self):
window = Tk()
# self.WINDOW_WIDTH = 720
# self.WINDOW_HEIGHT = 720
# self.X = window.winfo_screenwidth() // 2 - self.WINDOW_WIDTH // 2
# self.Y = window.winfo_screenheight() // 2 - self.WINDOW_HEIGHT // 2
self.WINDOW_WIDTH = window.winfo_screenwidth()
self.WINDOW_HEIGHT = window.winfo_screenheight()
self.X = 0
self.Y = 0
def create_infomation(self, saborn) -> dict:
info = platform.uname()
host_name = socket.gethostname()
temp = {
'IP' : socket.gethostbyname(host_name),
'userName' : info[1],
'MACAddress' : getmac.get_mac_address().replace(':', '-'),
'saborn' : saborn,
}
return temp
def screen_shot(self) -> Image:
screenshot = pyautogui.screenshot(region=(self.X, self.Y, self.WINDOW_WIDTH, self.WINDOW_HEIGHT))
return cv2.cvtColor(np.array(screenshot), cv2.COLOR_RGB2BGR)