21 lines
623 B
Python
21 lines
623 B
Python
from PySide6.QtWidgets import QSpinBox
|
|
from PySide6.QtGui import QFont
|
|
|
|
class CommaSpinBox(QSpinBox):
|
|
def __init__(self, *args, **kwargs):
|
|
super().__init__(*args, **kwargs)
|
|
|
|
# 폰트 설정
|
|
font = QFont()
|
|
font.setPointSize(10) # 폰트 크기 설정
|
|
font.setBold(True) # 폰트 굵게 설정
|
|
self.setFont(font)
|
|
|
|
# 스핀박스 설정
|
|
self.setRange(0, 1000000)
|
|
self.setSingleStep(10000)
|
|
|
|
def textFromValue(self, value):
|
|
"""숫자를 3자리마다 콤마 추가된 형식으로 표시"""
|
|
return f"{value:,}"
|