upload
BIN
CLASS/python_class.pptx
Normal file
BIN
CLASS/python_oop.pptx
Normal file
24
Logging/LOG.txt
Normal file
@ -0,0 +1,24 @@
|
||||
2023-12-01 14:08:23,270 - LOG.txt - INFO - Start
|
||||
2023-12-01 14:08:23,270 - LOG.txt - INFO - A : 0
|
||||
2023-12-01 14:08:23,270 - LOG.txt - INFO - Start
|
||||
2023-12-01 14:08:23,271 - LOG.txt - INFO - Start
|
||||
2023-12-01 14:08:23,271 - LOG.txt - INFO - B : 0
|
||||
2023-12-01 14:08:23,271 - LOG.txt - INFO - Start
|
||||
2023-12-01 14:08:23,271 - LOG.txt - INFO - C : 0
|
||||
2023-12-01 14:08:23,272 - LOG.txt - INFO - D : 0
|
||||
2023-12-01 14:08:23,772 - LOG.txt - INFO - A : 1
|
||||
2023-12-01 14:08:23,774 - LOG.txt - INFO - D : 1
|
||||
2023-12-01 14:08:23,774 - LOG.txt - INFO - B : 1
|
||||
2023-12-01 14:08:23,774 - LOG.txt - INFO - C : 1
|
||||
2023-12-01 14:08:24,274 - LOG.txt - INFO - A : 2
|
||||
2023-12-01 14:08:24,276 - LOG.txt - INFO - B : 2
|
||||
2023-12-01 14:08:24,276 - LOG.txt - INFO - D : 2
|
||||
2023-12-01 14:08:24,276 - LOG.txt - INFO - C : 2
|
||||
2023-12-01 14:08:24,775 - LOG.txt - INFO - A : 3
|
||||
2023-12-01 14:08:24,777 - LOG.txt - INFO - C : 3
|
||||
2023-12-01 14:08:24,777 - LOG.txt - INFO - D : 3
|
||||
2023-12-01 14:08:24,777 - LOG.txt - INFO - B : 3
|
||||
2023-12-01 14:08:25,277 - LOG.txt - INFO - A : 4
|
||||
2023-12-01 14:08:25,279 - LOG.txt - INFO - B : 4
|
||||
2023-12-01 14:08:25,279 - LOG.txt - INFO - D : 4
|
||||
2023-12-01 14:08:25,279 - LOG.txt - INFO - C : 4
|
6
Logging/LOG/Process/A-20231201.txt
Normal file
@ -0,0 +1,6 @@
|
||||
20231201 14:03:59 - INFO - Start
|
||||
20231201 14:03:59 - INFO - A : 0
|
||||
20231201 14:03:59 - INFO - A : 1
|
||||
20231201 14:04:00 - INFO - A : 2
|
||||
20231201 14:04:00 - INFO - A : 3
|
||||
20231201 14:04:01 - INFO - A : 4
|
6
Logging/LOG/Process/B-20231201.txt
Normal file
@ -0,0 +1,6 @@
|
||||
20231201 14:03:59 - INFO - Start
|
||||
20231201 14:03:59 - INFO - B : 0
|
||||
20231201 14:03:59 - INFO - B : 1
|
||||
20231201 14:04:00 - INFO - B : 2
|
||||
20231201 14:04:00 - INFO - B : 3
|
||||
20231201 14:04:01 - INFO - B : 4
|
6
Logging/LOG/Process/C-20231201.txt
Normal file
@ -0,0 +1,6 @@
|
||||
20231201 14:03:59 - INFO - Start
|
||||
20231201 14:03:59 - INFO - C : 0
|
||||
20231201 14:03:59 - INFO - C : 1
|
||||
20231201 14:04:00 - INFO - C : 2
|
||||
20231201 14:04:00 - INFO - C : 3
|
||||
20231201 14:04:01 - INFO - C : 4
|
6
Logging/LOG/Process/D-20231201.txt
Normal file
@ -0,0 +1,6 @@
|
||||
20231201 14:03:59 - INFO - Start
|
||||
20231201 14:03:59 - INFO - D : 0
|
||||
20231201 14:03:59 - INFO - D : 1
|
||||
20231201 14:04:00 - INFO - D : 2
|
||||
20231201 14:04:00 - INFO - D : 3
|
||||
20231201 14:04:01 - INFO - D : 4
|
0
Logging/LOG/Thread/A-20231201.txt
Normal file
0
Logging/LOG/Thread/A-20240416.txt
Normal file
0
Logging/LOG/Thread/B-20231201.txt
Normal file
0
Logging/LOG/Thread/B-20240416.txt
Normal file
0
Logging/LOG/Thread/C-20231201.txt
Normal file
0
Logging/LOG/Thread/C-20240416.txt
Normal file
0
Logging/LOG/Thread/D-20231201.txt
Normal file
0
Logging/LOG/Thread/D-20240416.txt
Normal file
80
Logging/Process_class.py
Normal file
@ -0,0 +1,80 @@
|
||||
import threading
|
||||
import multiprocessing as mp
|
||||
from queue import Queue #Thread 無法回傳值,所以要使用 Queue.put() 將要傳回的值存入 Queue,再用 Queue.get() 取出
|
||||
import time
|
||||
import os
|
||||
import datetime
|
||||
import logging
|
||||
import cv2
|
||||
|
||||
class Process_class(mp.Process):
|
||||
def __init__(self, code_name,q):
|
||||
mp.Process.__init__(self)
|
||||
self.code_name = code_name
|
||||
# log 設定
|
||||
#self.log_setting()
|
||||
self.q = q
|
||||
#self.log_setting_1()
|
||||
|
||||
|
||||
def run(self):
|
||||
self.t = self.code_name
|
||||
self.q.put(self.t)
|
||||
print('process {} '.format(os.getpid())) # 查看進程
|
||||
print('thread {} '.format(threading.current_thread().name)) # 查看線程
|
||||
# log 設定
|
||||
self.log_setting()
|
||||
self.logger = self.logger
|
||||
self.logger.info("Start")
|
||||
for i in range(0,5):
|
||||
self.logger.info(f'{self.code_name} : {i}')
|
||||
time.sleep(0.5)
|
||||
def test_return(self):
|
||||
return(f'{(self.q.get_nowait())}=END')
|
||||
|
||||
# log setting
|
||||
def log_setting(self):
|
||||
day_date = (datetime.datetime.now().strftime("%Y%m%d"))
|
||||
log_file = f'LOG\\Process\\{self.code_name}-{day_date}.txt'
|
||||
# 创建一个 Logger 对象
|
||||
self.logger = logging.getLogger(log_file)
|
||||
# 设置 Logger 级别
|
||||
self.logger.setLevel(logging.INFO)
|
||||
# 创建一个处理程序并将其级别设置为 INFO
|
||||
ch = logging.StreamHandler()
|
||||
ch.setLevel(logging.INFO)
|
||||
# 创建一个格式器并将其添加到处理程序
|
||||
formatter = logging.Formatter('%(asctime)s - %(levelname)-8s - %(message)s', datefmt='%Y%m%d %H:%M:%S')
|
||||
ch.setFormatter(formatter)
|
||||
# 将处理程序添加到 logger
|
||||
self.logger.addHandler(ch)
|
||||
# 创建一个文件处理程序并将其添加到 logger
|
||||
file_handler = logging.FileHandler(log_file)
|
||||
file_handler.setFormatter(formatter)
|
||||
self.logger.addHandler(file_handler)
|
||||
|
||||
def log_setting_1(self):
|
||||
log_file = f'LOG.txt'
|
||||
# create logger
|
||||
self.logger = logging.getLogger(log_file)
|
||||
self.logger.setLevel(logging.DEBUG)
|
||||
|
||||
# create console handler and set level to debug
|
||||
ch = logging.StreamHandler()
|
||||
ch.setLevel(logging.DEBUG)
|
||||
|
||||
# create file handler and set level to info
|
||||
fh = logging.FileHandler(log_file)
|
||||
fh.setLevel(logging.INFO)
|
||||
|
||||
# create formatter
|
||||
formatter = logging.Formatter(
|
||||
'%(asctime)s - %(name)-36s - %(levelname)-8s - %(message)s')
|
||||
|
||||
# add formatter to console handler and file handler
|
||||
ch.setFormatter(formatter)
|
||||
fh.setFormatter(formatter)
|
||||
|
||||
# add console handler and file handler to logger
|
||||
self.logger.addHandler(ch)
|
||||
self.logger.addHandler(fh)
|
79
Logging/Thread_class.py
Normal file
@ -0,0 +1,79 @@
|
||||
import threading
|
||||
import multiprocessing as mp
|
||||
from queue import Queue #Thread 無法回傳值,所以要使用 Queue.put() 將要傳回的值存入 Queue,再用 Queue.get() 取出
|
||||
import time
|
||||
import os
|
||||
import datetime
|
||||
import logging
|
||||
import cv2
|
||||
|
||||
class Thread_class(threading.Thread):
|
||||
def __init__(self,code_name,logeer):
|
||||
threading.Thread.__init__(self)
|
||||
self.code_name = code_name
|
||||
# log 設定
|
||||
#self.log_setting()
|
||||
self.log_setting_1()
|
||||
|
||||
def run(self):
|
||||
print('process {} '.format(os.getpid())) # 查看進程
|
||||
print('thread {} '.format(threading.current_thread().name)) # 查看線程
|
||||
# log 設定
|
||||
#self.log_setting_1()
|
||||
#logger = self.logger
|
||||
self.logger.info("Start")
|
||||
for i in range(0,5):
|
||||
self.logger.info(f'{self.code_name} : {i}')
|
||||
time.sleep(0.5)
|
||||
def test_return(self):
|
||||
return(f'{self.code_name}=END')
|
||||
|
||||
# log setting
|
||||
def log_setting(self):
|
||||
day_date = (datetime.datetime.now().strftime("%Y%m%d"))
|
||||
log_file = f'LOG\\Thread\\{self.code_name}-{day_date}.txt'
|
||||
# 创建一个 Logger 对象
|
||||
self.logger = logging.getLogger(log_file)
|
||||
# 设置 Logger 级别
|
||||
self.logger.setLevel(logging.INFO)
|
||||
# 创建一个处理程序并将其级别设置为 INFO
|
||||
ch = logging.StreamHandler()
|
||||
ch.setLevel(logging.INFO)
|
||||
# 创建一个格式器并将其添加到处理程序
|
||||
formatter = logging.Formatter('%(asctime)s - %(levelname)-8s - %(message)s', datefmt='%Y%m%d %H:%M:%S')
|
||||
ch.setFormatter(formatter)
|
||||
# 将处理程序添加到 logger
|
||||
self.logger.addHandler(ch)
|
||||
# 创建一个文件处理程序并将其添加到 logger
|
||||
file_handler = logging.FileHandler(log_file)
|
||||
file_handler.setFormatter(formatter)
|
||||
self.logger.addHandler(file_handler)
|
||||
|
||||
def log_setting_1(self):
|
||||
log_file = f'LOG.txt'
|
||||
day_date = (datetime.datetime.now().strftime("%Y%m%d"))
|
||||
log_file = f'LOG\\Thread\\{self.code_name}-{day_date}.txt'
|
||||
# create logger
|
||||
self.logger = logging.getLogger(log_file)
|
||||
self.logger.setLevel(logging.DEBUG)
|
||||
|
||||
# create console handler and set level to debug
|
||||
ch = logging.StreamHandler()
|
||||
ch.setLevel(logging.DEBUG)
|
||||
|
||||
# create file handler and set level to info
|
||||
fh = logging.FileHandler(log_file)
|
||||
fh.setLevel(logging.WARNING)
|
||||
|
||||
# create formatter
|
||||
formatter = logging.Formatter(
|
||||
'%(asctime)s - %(name)-36s - %(levelname)-8s - %(message)s')
|
||||
|
||||
# add formatter to console handler and file handler
|
||||
ch.setFormatter(formatter)
|
||||
fh.setFormatter(formatter)
|
||||
|
||||
# add console handler and file handler to logger
|
||||
self.logger.addHandler(ch)
|
||||
self.logger.addHandler(fh)
|
||||
|
BIN
Logging/__pycache__/Process_class.cpython-39.pyc
Normal file
BIN
Logging/__pycache__/Thread_class.cpython-39.pyc
Normal file
63
Logging/test_Logging_1129.py
Normal file
@ -0,0 +1,63 @@
|
||||
import threading
|
||||
import multiprocessing as mp
|
||||
from multiprocessing import Queue
|
||||
#from queue import Queue #Thread 無法回傳值,所以要使用 Queue.put() 將要傳回的值存入 Queue,再用 Queue.get() 取出
|
||||
import time
|
||||
import os
|
||||
import datetime
|
||||
import logging
|
||||
import cv2
|
||||
from Process_class import Process_class
|
||||
from Thread_class import Thread_class
|
||||
|
||||
log_file = f'LOG.txt'
|
||||
# create logger
|
||||
logger = logging.getLogger(log_file)
|
||||
logger.setLevel(logging.DEBUG)
|
||||
|
||||
# create console handler and set level to debug
|
||||
ch = logging.StreamHandler()
|
||||
ch.setLevel(logging.DEBUG)
|
||||
|
||||
# create file handler and set level to info
|
||||
fh = logging.FileHandler(log_file)
|
||||
fh.setLevel(logging.INFO)
|
||||
|
||||
# create formatter
|
||||
formatter = logging.Formatter(
|
||||
'%(asctime)s - %(name)-36s - %(levelname)-8s - %(message)s')
|
||||
|
||||
# add formatter to console handler and file handler
|
||||
ch.setFormatter(formatter)
|
||||
fh.setFormatter(formatter)
|
||||
|
||||
# add console handler and file handler to logger
|
||||
logger.addHandler(ch)
|
||||
logger.addHandler(fh)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if __name__=='__main__':
|
||||
q = Queue()
|
||||
name_list = ["A", "B", "C", "D"]
|
||||
process_list = []
|
||||
for i in range(0, len(name_list)):
|
||||
process_list.append(Thread_class(name_list[i],q))
|
||||
for i in range(0, len(process_list)):
|
||||
process_list[i].start()
|
||||
for i in range(0, len(process_list)):
|
||||
process_list[i].join()
|
||||
|
||||
for i in range(0, len(process_list)):
|
||||
#print(q.get())
|
||||
print(process_list[i].test_return())
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
BIN
Thread/python_thread.pptx
Normal file
BIN
Yolo/PPT/colab訓練yolov5.pptx
Normal file
BIN
Yolo/PPT/yolov5.pptx
Normal file
BIN
pyqt5/CODE/testui_0826/icon/add-1.png
Normal file
After Width: | Height: | Size: 5.1 KiB |
BIN
pyqt5/CODE/testui_0826/icon/add-2.png
Normal file
After Width: | Height: | Size: 854 B |
BIN
pyqt5/CODE/testui_0826/icon/add-3.png
Normal file
After Width: | Height: | Size: 2.1 KiB |
BIN
pyqt5/CODE/testui_0826/icon/add.png
Normal file
After Width: | Height: | Size: 479 B |
BIN
pyqt5/CODE/testui_0826/icon/agenda.png
Normal file
After Width: | Height: | Size: 4.5 KiB |
BIN
pyqt5/CODE/testui_0826/icon/alarm-1.png
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
pyqt5/CODE/testui_0826/icon/alarm-clock-1.png
Normal file
After Width: | Height: | Size: 18 KiB |
BIN
pyqt5/CODE/testui_0826/icon/alarm-clock.png
Normal file
After Width: | Height: | Size: 14 KiB |
BIN
pyqt5/CODE/testui_0826/icon/alarm.png
Normal file
After Width: | Height: | Size: 9.4 KiB |
BIN
pyqt5/CODE/testui_0826/icon/albums.png
Normal file
After Width: | Height: | Size: 11 KiB |
BIN
pyqt5/CODE/testui_0826/icon/app.png
Normal file
After Width: | Height: | Size: 4.3 KiB |
BIN
pyqt5/CODE/testui_0826/icon/archive-1.png
Normal file
After Width: | Height: | Size: 3.5 KiB |
BIN
pyqt5/CODE/testui_0826/icon/archive-2.png
Normal file
After Width: | Height: | Size: 4.6 KiB |
BIN
pyqt5/CODE/testui_0826/icon/archive-3.png
Normal file
After Width: | Height: | Size: 6.4 KiB |
BIN
pyqt5/CODE/testui_0826/icon/archive.png
Normal file
After Width: | Height: | Size: 3.0 KiB |
BIN
pyqt5/CODE/testui_0826/icon/attachment.png
Normal file
After Width: | Height: | Size: 6.4 KiB |
BIN
pyqt5/CODE/testui_0826/icon/back.png
Normal file
After Width: | Height: | Size: 4.5 KiB |
BIN
pyqt5/CODE/testui_0826/icon/battery-1.png
Normal file
After Width: | Height: | Size: 9.7 KiB |
BIN
pyqt5/CODE/testui_0826/icon/battery-2.png
Normal file
After Width: | Height: | Size: 8.1 KiB |
BIN
pyqt5/CODE/testui_0826/icon/battery-3.png
Normal file
After Width: | Height: | Size: 6.4 KiB |
BIN
pyqt5/CODE/testui_0826/icon/battery-4.png
Normal file
After Width: | Height: | Size: 5.1 KiB |
BIN
pyqt5/CODE/testui_0826/icon/battery-5.png
Normal file
After Width: | Height: | Size: 2.5 KiB |
BIN
pyqt5/CODE/testui_0826/icon/battery-6.png
Normal file
After Width: | Height: | Size: 2.5 KiB |
BIN
pyqt5/CODE/testui_0826/icon/battery-7.png
Normal file
After Width: | Height: | Size: 2.4 KiB |
BIN
pyqt5/CODE/testui_0826/icon/battery-8.png
Normal file
After Width: | Height: | Size: 2.4 KiB |
BIN
pyqt5/CODE/testui_0826/icon/battery-9.png
Normal file
After Width: | Height: | Size: 11 KiB |
BIN
pyqt5/CODE/testui_0826/icon/battery.png
Normal file
After Width: | Height: | Size: 5.0 KiB |
BIN
pyqt5/CODE/testui_0826/icon/binoculars.png
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
pyqt5/CODE/testui_0826/icon/blueprint.png
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
pyqt5/CODE/testui_0826/icon/bluetooth-1.png
Normal file
After Width: | Height: | Size: 3.9 KiB |
BIN
pyqt5/CODE/testui_0826/icon/bluetooth.png
Normal file
After Width: | Height: | Size: 11 KiB |
BIN
pyqt5/CODE/testui_0826/icon/bookmark-1.png
Normal file
After Width: | Height: | Size: 4.4 KiB |
BIN
pyqt5/CODE/testui_0826/icon/bookmark.png
Normal file
After Width: | Height: | Size: 4.2 KiB |
BIN
pyqt5/CODE/testui_0826/icon/briefcase.png
Normal file
After Width: | Height: | Size: 2.8 KiB |
BIN
pyqt5/CODE/testui_0826/icon/broken-link.png
Normal file
After Width: | Height: | Size: 8.6 KiB |
BIN
pyqt5/CODE/testui_0826/icon/calculator-1.png
Normal file
After Width: | Height: | Size: 2.5 KiB |
BIN
pyqt5/CODE/testui_0826/icon/calculator.png
Normal file
After Width: | Height: | Size: 3.9 KiB |
BIN
pyqt5/CODE/testui_0826/icon/calendar-1.png
Normal file
After Width: | Height: | Size: 6.3 KiB |
BIN
pyqt5/CODE/testui_0826/icon/calendar-2.png
Normal file
After Width: | Height: | Size: 6.7 KiB |
BIN
pyqt5/CODE/testui_0826/icon/calendar-3.png
Normal file
After Width: | Height: | Size: 8.5 KiB |
BIN
pyqt5/CODE/testui_0826/icon/calendar-4.png
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
pyqt5/CODE/testui_0826/icon/calendar-5.png
Normal file
After Width: | Height: | Size: 2.5 KiB |
BIN
pyqt5/CODE/testui_0826/icon/calendar-6.png
Normal file
After Width: | Height: | Size: 8.1 KiB |
BIN
pyqt5/CODE/testui_0826/icon/calendar-7.png
Normal file
After Width: | Height: | Size: 7.5 KiB |
BIN
pyqt5/CODE/testui_0826/icon/calendar.png
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
pyqt5/CODE/testui_0826/icon/checked-1.png
Normal file
After Width: | Height: | Size: 2.9 KiB |
BIN
pyqt5/CODE/testui_0826/icon/checked.png
Normal file
After Width: | Height: | Size: 2.8 KiB |
BIN
pyqt5/CODE/testui_0826/icon/clock-1.png
Normal file
After Width: | Height: | Size: 11 KiB |
BIN
pyqt5/CODE/testui_0826/icon/clock.png
Normal file
After Width: | Height: | Size: 3.9 KiB |
BIN
pyqt5/CODE/testui_0826/icon/close.png
Normal file
After Width: | Height: | Size: 3.0 KiB |
BIN
pyqt5/CODE/testui_0826/icon/cloud-computing-1.png
Normal file
After Width: | Height: | Size: 8.9 KiB |
BIN
pyqt5/CODE/testui_0826/icon/cloud-computing-2.png
Normal file
After Width: | Height: | Size: 8.5 KiB |
BIN
pyqt5/CODE/testui_0826/icon/cloud-computing-3.png
Normal file
After Width: | Height: | Size: 9.5 KiB |
BIN
pyqt5/CODE/testui_0826/icon/cloud-computing-4.png
Normal file
After Width: | Height: | Size: 9.8 KiB |
BIN
pyqt5/CODE/testui_0826/icon/cloud-computing-5.png
Normal file
After Width: | Height: | Size: 9.8 KiB |
BIN
pyqt5/CODE/testui_0826/icon/cloud-computing.png
Normal file
After Width: | Height: | Size: 8.5 KiB |
BIN
pyqt5/CODE/testui_0826/icon/cloud.png
Normal file
After Width: | Height: | Size: 6.9 KiB |
BIN
pyqt5/CODE/testui_0826/icon/command.png
Normal file
After Width: | Height: | Size: 9.2 KiB |
BIN
pyqt5/CODE/testui_0826/icon/compact-disc-1.png
Normal file
After Width: | Height: | Size: 15 KiB |
BIN
pyqt5/CODE/testui_0826/icon/compact-disc-2.png
Normal file
After Width: | Height: | Size: 13 KiB |
BIN
pyqt5/CODE/testui_0826/icon/compact-disc.png
Normal file
After Width: | Height: | Size: 14 KiB |
BIN
pyqt5/CODE/testui_0826/icon/compass.png
Normal file
After Width: | Height: | Size: 10 KiB |
BIN
pyqt5/CODE/testui_0826/icon/compose.png
Normal file
After Width: | Height: | Size: 14 KiB |
BIN
pyqt5/CODE/testui_0826/icon/controls-1.png
Normal file
After Width: | Height: | Size: 7.8 KiB |
BIN
pyqt5/CODE/testui_0826/icon/controls-2.png
Normal file
After Width: | Height: | Size: 2.9 KiB |
BIN
pyqt5/CODE/testui_0826/icon/controls-3.png
Normal file
After Width: | Height: | Size: 3.1 KiB |
BIN
pyqt5/CODE/testui_0826/icon/controls-4.png
Normal file
After Width: | Height: | Size: 6.4 KiB |
BIN
pyqt5/CODE/testui_0826/icon/controls-5.png
Normal file
After Width: | Height: | Size: 7.2 KiB |
BIN
pyqt5/CODE/testui_0826/icon/controls-6.png
Normal file
After Width: | Height: | Size: 2.4 KiB |
BIN
pyqt5/CODE/testui_0826/icon/controls-7.png
Normal file
After Width: | Height: | Size: 2.9 KiB |
BIN
pyqt5/CODE/testui_0826/icon/controls-8.png
Normal file
After Width: | Height: | Size: 11 KiB |
BIN
pyqt5/CODE/testui_0826/icon/controls-9.png
Normal file
After Width: | Height: | Size: 4.3 KiB |
BIN
pyqt5/CODE/testui_0826/icon/controls.png
Normal file
After Width: | Height: | Size: 7.8 KiB |
BIN
pyqt5/CODE/testui_0826/icon/database-1.png
Normal file
After Width: | Height: | Size: 11 KiB |