본문 바로가기
  • Tried. Failed. Logged.
728x90

파이썬84

PyQt - 리소스 적용하기 [경로] images/ ├─ icon.png main.py resources.qrc [resources.qrc] images/icon.png [리소스 파일 변환하기] pyrcc5 resources.qrc -o icon.py [main.py] import icon ... label=QLabel(Form) label.setPixmap( QPixmap(":/images/icon.png") ) # qrc에서 적은 경로명 label.resize(label.pixmap().width(), label.pixmap().height()) ... 출처: https://m.blog.naver.com/PostView.naver?isHttpsRedirect=true&blogId=browniz1004&logNo=221373310.. 2022. 5. 31.
파이썬 - 현재 라인번호 출력 import inspect def lineno(): """ 이 함수를 호출한 곳의 라인번호를 리턴한다. """ return inspect.getlineno(inspect.getouterframes(inspect.currentframe())[-1][0]) print( lineno() ) try: " " except Exception as e: self.print_log( '[' + str(lineno()) + ']' '예외: ' + str(e), err=True) 출처: https://technote.luminance.kr/entry/python-%EB%94%94%EB%B2%84%EA%B7%B8-line-%EB%B2%88%ED%98%B8-%EC%B0%8D%EA%B8%B0 python 디버그: line 번호.. 2022. 5. 25.
셀레니움 - chromedriver 자동 업데이트 및 설치 pip install chromedriver_autoinstaller from selenium import webdriver import chromedriver_autoinstaller def driverAutoInstall(): chromedriver_autoinstaller.install() driver = webdriver.Chrome() return driver driver = driverAutoInstall() driver.get('http://google.com') 출처: https://dev-guardy.tistory.com/78 [Python] chromedriver selenium 자동설치 [셀레니움, 크롬드라이버] Python , chromedrvier, Selenium, 셀레니움, 크.. 2022. 5. 23.
OpenCV - 커스텀 Cascade 만들기(CASCADE TRAINER GUI) 및 물체 탐지 아래 링크에서 Cascade Trainer GUI를 자신의 컴퓨터 환경에 맞는 버전으로 설치(64비트가 32비트 버전으로 설치하면 중간에 오류가 생김) https://amin-ahmadi.com/cascade-trainer-gui/ Cascade Trainer GUI - Amin Cascade Trainer GUI 1. Introduction Cascade Trainer GUI is a program that can be used to train, test and improve cascade classifier models. It uses a graphical interface to set the parameters and make it easy to use OpenCV tools for training.. 2022. 5. 19.
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.
728x90