python/기타
-
python pyQt5 모니터 관련 함수python/기타 2021. 10. 22. 11:06
from PyQt5.QtWidgets import * app = QApplication([]) # 모니터 갯수 반환 app.desktop().screenNumber() # 주 모니터 선택 screen = app.primaryScreen() # 모니터 이름 (\\.\DISPLAY1) print(screen.name()) # 해상도 ( 작업표시줄을 제외한 영역을 반환할 경우 아래 함수 사용 ) print(screen.geometry()) print(screen.availableGeometry()) # 다중 모니터 해상도 구하기 monitorCount = app.desktop().screenCount() for i in range(monitorCount): print(app.desktop().available..
-
python 으로 window service 관리python/기타 2021. 10. 6. 17:08
최근 윈도우 웹서버에서 apache 서비스가 자꾸 죽는 경우가 생겨서 python 으로 window 서비스를 정지, 시작, 재시작 프로그램을 작성하였습니다. 필요 모듈로는 pywin32, requests pip install pywin32 pip install requests 을 이용해서 설치합니다. import requests import win32serviceutil r = requests.get('http://www.aaa.com', timeout=10) # 응답이 없거나 200 이 아니면 재시작 if r.status_code != 200 : try: win32serviceutil.QueryServiceStatus(serviceName) except Exception as e: print("그런 서..