본문 바로가기
728x90
반응형

파이썬80

PyQt - 디렉토리 및 파일 경로 불러오기(QFileDialog) from PyQt5.QtWidgets import * path = QFileDialog.getExistingDirectory() print(path) file = QFileDialog.getOpenFileName() print(file) 출처: https://wikidocs.net/5247 1) QFileDialog 이번 절에서는 PyQt가 제공하는 QFileDigalog 클래스에 대해 알아보겠습니다. QFileDigalog는 그림 16.43과 같이 사용자가 파일이나 디렉터리를 선택할 ... wikidocs.net 2022. 5. 19.
OpenCV - 캡챠 문자 검출하기 import cv2 import numpy as numpy import matplotlib.pyplot as plt img = cv2.imread('./characters.PNG') img = cv2.blur(img, (10, 10), anchor=(-1, -1), borderType=cv2.BORDER_DEFAULT) # 블러처리(떨어진 조각을 붙이기) img_gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) # 회색 전환 img_gray = 255 - img_gray # 이미지 반전 res, thr = cv2.threshold(img_gray, 90, 255, cv2.THRESH_BINARY) # 이진화 cv2.imshow('gray', thr) contours, hie.. 2022. 5. 18.
PyQt - 스타일시트 레퍼런스 https://doc.qt.io/archives/qt-4.8/stylesheet-reference.html#list-of-properties Qt Style Sheets Reference | Qt 4.8 Qt Style Sheets Reference Qt Style Sheets support various properties, pseudo-states, and subcontrols that make it possible to customize the look of widgets. The following table lists the Qt widgets that can be customized using style sheets: WidgetHow to St doc.qt.io 출처: https://forum.. 2022. 5. 9.
파이썬 - ini 설정 파일 불러오기 import configparser def readConfigure(self): config = configparser.ConfigParser() config.read('./settings.ini', encoding='utf-8') settings = config['settings'] self.uid = settings['uid'] self.upw = settings['upw'] 2022. 5. 8.
파이썬 - 스레드 상관 없이 프로그램 완전 종료 import os os._exit() 출처: https://stackoverflow.com/questions/905189/why-does-sys-exit-not-exit-when-called-inside-a-thread-in-python Why does sys.exit() not exit when called inside a thread in Python? I am confused as to why the following code snippet would not exit when called in the thread, but would exit when called in the main thread. import sys, time from threading import Thread def testex... 2022. 5. 7.
PyQt - 간단하게 토글 스위치 디자인하기 QCheckBox::indicator:unchecked { image: url("switch_off.png"); } QCheckBox::indicator:checked { image: url("switch_on.png"); } 이미지를 이용해서 토글 디자인 출처: https://stackoverflow.com/questions/62363953/how-to-create-toggle-switch-button-in-qt-designer How to create toggle switch button in qt designer? I am trying to create toggle button in qt designer. I refer on internet also but i couldn't find how to .. 2022. 5. 7.
PyQt - designer .ui를 .py로 변환하기 pyuic5 -x sub.ui -o sub.py 2022. 5. 7.
PyQt - 윈도우창 투명하게 만들기 [완전 투명하게 만들기] Form.setWindowFlags(QtCore.Qt.FramelessWindowHint) Form.setAttribute(QtCore.Qt.WA_TranslucentBackground) Form.setStyleSheet("background:transparent;") [불투명도 설정] Form.setWindowOpacity(0.5) 출처: https://stackoverflow.com/questions/7667552/qt-widget-with-transparent-background Qt Widget with Transparent Background (I'm using PySide, but I think the answer would be the same/similar for .. 2022. 5. 7.
PyQt - 트레이(Tray) 만들기 및 메뉴 추가 from PyQt5.QtGui import QIcon trayIcon = QSystemTrayIcon(Form) icon = QIcon("icon.png") trayIcon.setIcon(icon) trayIcon.setToolTip('트레이 아이콘 설명') trayIcon.setVisible(True) trayIcon.show() menu = QMenu() exitAction = menu.addAction('Exit') exitAction.triggered.connect(app.quit) trayIcon.setContextMenu(menu) 참고: https://www.pythonguis.com/tutorials/system-tray-mac-menu-bar-applications-pyqt/ System.. 2022. 5. 7.
PyQt - designer 스타일시트 추가하기 원하는 위젯 우클릭하고 styleSheet 바꾸기 클릭 ​이런식으로 border, :hover 등 다양한 스타일시트를 설정할 수 있음 문법은 CSS와 동일하며 다만 기능은 더 적다. 참고: https://blog.naver.com/PostView.naver?blogId=dhksrl0508&logNo=222344023916&parentCategoryNo=&categoryNo=232&viewDate=&isShowPopularPosts=false&from=postView PyQt StyleSheet로 Visual Studio UI를 만들어보자 마이크로소프트는 UI를 정말 잘 만드는 것 같습니다. 학교 공부로 Visual C++ 실습을 진행하는데, 우연... blog.naver.com 2022. 5. 7.
셀레니움 - 네이버 로그인 봇 탐지 우회하기 from selenium import webdriver from selenium.webdriver.common.keys import Keys import pyperclip import time uid = '{아이디}' upw = '{비밀번호}' driver = webdriver.Chrome('chromedriver.exe') driver.implicitly_wait(15) driver.get('https://nid.naver.com/nidlogin.login?mode=form&url=https%3A%2F%2Fwww.naver.com') pyperclip.copy(uid) time.sleep(1) driver.find_element_by_xpath('/html/body/div[1]/div[2]/div/di.. 2022. 2. 8.
OpenCV - 파이썬 웹캠 눈, 얼굴 인식 import cv2 face_cascade_filename = 'haarcascade_frontalface_default.xml' face_cascasde = cv2.CascadeClassifier( cv2.data.haarcascades + face_cascade_filename) eye_cascade_filename = 'haarcascade_eye.xml' eye_cascade = cv2.CascadeClassifier( cv2.data.haarcascades + eye_cascade_filename) capture = cv2.VideoCapture(0) while cv2.waitKey(33) < 0: ret, frame = capture.read() faces = face_cascasde.dete.. 2022. 2. 2.
728x90
반응형