일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | |
7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 | 29 | 30 |
- python
- tensorflow
- MySQL
- 다이어트
- ubuntu
- 유니티
- 날짜
- 라즈베리파이
- port
- sqlite
- node.js
- GIT
- MS-SQL
- 함수
- Linux
- ASP
- urllib
- Unity
- swift
- mssql
- flutter
- IOS
- PyQt5
- 맛집
- Excel
- PyQt
- pandas
- javascript
- 리눅스
- PER
목록랭귀지 (579)
아미(아름다운미소)
c라이브러리에 있는 fmod()함수를 호출(math.fmod(x,y)) 파이썬 연산자중 '%'(나머지연산)과 유사합니다. 하지만 % 연산결과는 항상 동일한것은 아닙니다. math.fmod(x,y)연산은 항상 피제수 x와 몫으 부호가 동일하지만 '%'연산은 몫이 피제수와 항상 일치하지 않기 때문입니다. 또한 부동소수점 연사자의 정확도차이도 존재하기 때문에 일반적으로 정수연산에는 '%'연산을 부동소수점연산에는 math.fmod()연산을 사용하는것을 권장합니다. ''' Created on 2018. 12. 31. @author: bhm ''' import math N = 10 if math.fmod(N,2): print('odd') else: print('even')
파이썬은 기본적으로 대부분의 변수를 지역변수로 사용합니다. 전역변수 선언을 위한 키워드는 global입니다. ''' Created on 2018. 12. 31. @author: bhm ''' globvar = 4 def func2(): print(globvar) def func(): global globvar globvar += 1 if(globvar%5) == 0: print(globvar) def func3(): print(globvar) func() func2() func3() 결과) 5 5 5
Python pyqt5 QTableWidget 너비 높이 조정 QTableWidget.setFixedSize(width, height)
PySide : QVBoxLayout의 너비 설정 v_widget = QWidget() v_widget.setLayout(vlayout) v_widget.setFixedWidth(80)
How to display an image onto a PyQT window QLabel은 setPixmap 메서드를 가지고 있기 때문에 이미지를 표시 할 수 있습니다. 예제) lb = QtGui.QLabel(self) pixmap = QtGui.QPixmap("{경로/파일}") height_label = 100 lb.resize(self.width(), height_label) lb.setPixmap(pixmap.scaled(lb.size(), QtCore.Qt.IgnoreAspectRatio)) self.show()
QTableWidget의 특정 셀을 읽기 전용으로 만들려면,플래그를 변경하여 셀의 동작 / 속성을 변경합니다 item = QTableWidgetItem() item.setFlags(item.flags() ^ Qt.ItemIsEditable) tableName.setItem(row, column, item)
Python PyQt5 선택한 날짜에 setStyleSheet backgroundcolor #33ccff 적용 ''' Created on 2018. 12. 19. @author: bhm ''' from PyQt5 import QtWidgets QSS = ''' QCalendarWidget QAbstractItemView { selection-background-color: #33ccff; selection-color: white; } ''' class CalendarWidget(QtWidgets.QCalendarWidget): def __init__(self, parent=None): super(CalendarWidget, self).__init__(parent, verticalHeaderFormat=Q..
Python PyQt How to convert from Python to QDate style 2018-12-19 -> 2018 12 19 변경 qtDate = QtCore.QDate.fromString(myPythonicDate, 'yyyy-MM-dd') print(qtDate.year(), qtDate.month(), qtDate.day()) 결과 : 2018 12 19
Python pyqt tableWidget double click event #-*- coding: utf-8 -*- self.tableWidget.doubleClicked.connect(self.tableWidget_doubleClicked) def treeMedia_doubleClicked(self): row = self.tableWidget.currentIndex().row() column = self.tableWidget.currentIndex().column() print(row, column)