본문 바로가기

Python49

Jupyter Lab CSS 변경 Jupyter Lab CSS 변경 Jupyter lab Dark 테마에서 문자열색이 잘 안보이는 문제가 발생 extension으로 테마 변경 위 방법으로 안되면 CSS 변경 Extension 활성화를 통해 추가 테마 설치 setting → Advanced Settings Editor 클릭 Extension Manager 선택후 User Preferences 를 작성합니다. { "enabled": true } 저장한 후 확장탭에서 테마 검색 후 설치합니다. 만약 버전이 안맞아서 build 에서 실패할 경우 CSS를 직접 수정합니다. CSS 수정 dark 테마의 경우 /usr/local/share/jupyter/lab/themes/@jupyterlab/theme-dark-extension 에 있는 index.. 2019. 7. 3.
Amazfit Bip Font Creator 5 - 실행 파일 생성 Amazfit Bip Font Creator 5 - 실행 파일 생성 실행 파일은 pyinstaller 로 생성합니다. 먼저 pyinstaller 를 설치합니다. $ pip install pyinstaller 이 후 pyinstaller 파일명 을 입력하여 exe파일을 생성할 수 있습니다. 여기서 몇 가지 옵션을 사용합니다. $ pyinstaller --onefile --clean --windowed --icon=.\assets\font.ico Amazfit_Bip_Font_Creator.py --onefile : 하나의 파일로 생성합니다. 이 옵션이 없으면 여러개의 파일로 생성됩니다 --clean : 기존 파일들을 삭제합니다. --windowed : 윈도우창으로 실행되도록 합니다. 이 옵션이 없으면 cm.. 2018. 5. 15.
Amazfit Bip Font Creator 4 - 폰트 생성 Amazfit Bip Font Creator 4 - 폰트 생성 쓰레드 초기화가 끝났으면, font_creator_thread.start()로 run을 실행합니다. class FontCreator(QThread): # 생략 def run(self): self.set_progress_text.emit("1/2") self.create_bmp() self.set_progress_text.emit("2/2") self.pack_bmp() if self.delete_bmp: shutil.rmtree(self.bmp_dir) self.done.emit() 먼저 bmp 파일들을 생성하고 패킹하여 폰트파일을 생성합니다. create_bmp # bip_font_creator.py import os import binas.. 2018. 5. 14.
Amazfit Bip Font Creator 3 - 쓰레드 실행 Amazfit Bip Font Creator 3 - 쓰레드 실행 쓰레드 생성 # bip_font_creator.py import os import binascii import glob import shutil from PyQt5.QtCore import QThread, pyqtSignal from fontTools.ttLib import TTFont from PIL import ImageFont, ImageDraw, Image class FontCreator(QThread): set_progress_text = pyqtSignal(str) set_progress = pyqtSignal(int, int) done = pyqtSignal() def __init__(self, font_path, margin_.. 2018. 5. 13.
Amazfit Bip Font Creator 2 - 이벤트 구현 Amazfit Bip Font Creator 2 - 이벤트 구현 Select TTF file 버튼 이벤트 Font File Create 버튼 이벤트 Select TTF file class AmazfitBipFontCreator(QMainWindow): # .. 생략 .. def get_create_box(self): # .. 생략 .. btn_ttf = QPushButton('Select TTF file') btn_ttf.clicked.connect(lambda: self.select_file(self.lbl_ttf)) 이벤트 처리시에 파라미터 전달을 위해 lambda로 구현하였습니다. 파일선택다이얼로그에서 파일을 선택할 경우 라벨에 표시하기 위해 표시 대상(self.lbl_ttf)을 전달합니다. cla.. 2018. 5. 12.
Amazfit Bip Font Creator 1 - UI 구성 Amazfit Bip Font Creator 1 - UI 구성 Amazfit Bip 에서 사용할 폰트를 생성합니다. Qt5를 사용하여 UI를 생성합니다. Qt5 사용 QT에서 UI를 생성할 경우QMainWindow를 사용시에는 Widget을 생성하고 setCentrlWidget을 호출해야 합니다. class AmazfitBipFontCreator(QMainWindow): def __init__(self): widget = QWidget() # UI 구성 self.setCentralWidget(widget) self.show() 위와 다르게, QWidget, QDialog를 사용한다면 그냥 self.show()를 해서 보여줄 수 있습니다. class AmazfitBipFontCreator(QDialog):.. 2018. 5. 11.