일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 | 31 |
- MySQL
- node.js
- urllib
- PyQt5
- pandas
- IOS
- PER
- MS-SQL
- 리눅스
- GIT
- Linux
- Excel
- mssql
- sqlite
- 다이어트
- flutter
- javascript
- 날짜
- python
- 유니티
- ubuntu
- tensorflow
- 맛집
- Unity
- 라즈베리파이
- PyQt
- swift
- 함수
- ASP
- port
목록python (161)
아미(아름다운미소)
Python PyQt5 click action on Qwidget ''' Created on 2018. 12. 10. @author: bhm ''' from PyQt5.QtWidgets import (QWidget, QApplication) import sys class MyWidget(QWidget): def mousePressEvent(self, event): print("clicked") app = QApplication(sys.argv) widget = MyWidget() widget.show() app.exec_()
PyQt5 QInputDialog 다이얼로그팝업 #-*- coding: utf-8 -*- ''' Created on 2018. 12. 10. @author: bhm ''' from PyQt5.QtWidgets import (QInputDialog, QApplication) app = QApplication([]) dialog = QInputDialog() dialog.show() app.exec_()
Python PyQt5 submenu Python PyQt5 서브메뉴 예제 # -*- coding: utf-8 -*- import sys from PyQt5.QtWidgets import QMainWindow, QAction, QMenu, QApplication class Example(QMainWindow): def __init__(self): super().__init__() self.initUI() def initUI(self): menubar = self.menuBar() fileMenu = menubar.addMenu('파일') impMenu = QMenu('열기', self) impAct = QAction('서브메뉴열기', self) impMenu.addAction(impAct) newAct ..
python 서버 시간 확인하기 response 메시지 헤더에 있는 서버 시간정보 값을 가져옵니다. strptime() : 문자열을 날짜/시간으로 변환 mktime() : 일시를 초 단위 시간으로 변환 #-*- coding: utf-8 -*- import urllib.request import urllib.error import time date = urllib.request.urlopen('http://www.google.com').headers['Date'] print(date) time = int(time.mktime(time.strptime(date, '%a, %d %b %Y %H:%M:%S %Z'))) print(time) Tue, 04 Dec 2018 07:38:24 GMT 1543876704
python PyQt5 현재시간 #-*- coding: utf-8 -*- ''' Created on 2018. 12. 3. @author: bhm ''' from PyQt5.QtCore import QTime current_time = QTime.currentTime() text_time = current_time.toString("hh:mm:ss") time_msg = "현재시간: " + text_time print(time_msg) 현재시간: 13:14:46
subprocess 모듈을 이용한 명령어 실행 #-*- coding: utf-8 -*- import subprocess subprocess.Popen('.\folder\program.exe')
문자열을 입력받아 그 문자열에서 숫자만 제거하고 출력 #-*- coding: utf-8 -*- ''' Created on 2018. 11. 26. @author: bhm ''' import re char = "123abcdefghi4jk56" p = re.compile("[^0-9]") print("".join(p.findall(char))) 결과) abcdefghijk
Python PyQt5 combobox import sys from PyQt5 import QtCore, QtWidgets from PyQt5.QtWidgets import QMainWindow, QLabel, QGridLayout, QWidget, QComboBox from PyQt5.QtCore import QSize, QRect class ExampleWindow(QMainWindow): def __init__(self): QMainWindow.__init__(self) self.setMinimumSize(QSize(300, 300)) self.setWindowTitle("PyQt5 Combobox example") centralWidget = QWidget(self) self.setCentralW..
json은 URL요청시 입출력 데이터로 많이 활용됩니다. 예제) import json import urllib.request url = "http://www.test.com" # URL d = {'name': '테스트', 'birth': '0703', 'age': 47} params = json.dumps(d).encode("utf-8") # encode: 문자열을 바이트로 변환 req = urllib.request.Request(url, data=params, headers={'content-type': 'application/json'}) response = urllib.request.urlopen(req) print(response.read().decode('utf8')) # decode: 바이트를..
pyqt5 QTableWidget QTableWidget() 으로 생성 합니다. row, column 을 설정합니다. 아이템을 설정합니다. self.itemTable = QTableWidget() self.itemTable.setRowCount(2) self.itemTable.setColumnCount(2) self.itemTable.setItem(0, 0, QTableWidgetItem("(0,0)")) self.itemTable.setItem(0, 1, QTableWidgetItem("(0,1)")) self.itemTable.setItem(1, 0, QTableWidgetItem("(1,0)")) self.itemTable.setItem(1, 1, QTableWidgetItem("(1,1)")) 동..