반응형
현재년도를 기준으로 과거 5년, 미래 5년에 대한 10개 콤보박스를 구현해보았다.
self.year_select_combobox = QComboBox()
current_year = datetime.now().year
past_years = [str(current_year - i) for i in range(5, 0, -1)]
future_years = [str(current_year + i) for i in range(1, 6)]
year_list = past_years + [str(current_year)] + future_years
self.year_select_combobox.addItems(year_list)
self.year_select_combobox.setCurrentText(str(datetime.now().year))
반응형
'프로그래밍 > python' 카테고리의 다른 글
python 코드로 pnu(필지고유번호) 번호 만드는 방법 (0) | 2024.04.09 |
---|---|
[FastAPI] 307 Temporary Redirect 오류 나는 원인 (0) | 2024.02.16 |
selenium element에서 가장 가까운 부모중 특정 태그(tr) 찾기 (0) | 2024.01.22 |
pandas dataframe 에서 특정 컬럼에 데이터가 존재하는 경우 다른 컬럼 수정 (0) | 2023.12.15 |
selenium으로 network 탭에서 호출된 특정 url 의 데이터 가져오기 (0) | 2023.12.11 |