# -*- coding:utf-8 -*- import sys from PyQt5 import QtCore from PyQt5.QtWidgets import QCalendarWidget, QLabel, QDialog class CalendarDialog(QDialog): def __init__(self, _parent): super(CalendarDialog, self).__init__(_parent) self.setModal(True) self.cal = QCalendarWidget(self) self.initUI() self.adjustSize() self.setFixedSize(self.width(), self.height()) self.selectedDate = None def initUI(self): self.cal.setGridVisible(True) self.cal.move(20, 20) self.cal.clicked[QtCore.QDate].connect(self.showDate) self.lbl = QLabel(self) date = self.cal.selectedDate() self.lbl.setText(date.toString()) self.lbl.move(20, 200) self.setWindowTitle('Calendar') self.show() def showDate(self, date): self.lbl.setText(date.toString()) self.close() def main(): app = QApplication(sys.argv) ex = Example() sys.exit(app.exec_()) if __name__ == '__main__': main()
2018년 11월 21일 수요일
[QGIS3] QCalendarWidget
[PyQt5] QWidgetAction sample
# -*- coding: utf-8 -*- import sys from PyQt5.QtWidgets import QMainWindow, QApplication, QWidgetAction, QMenu class Example(QMainWindow): def __init__(self): super().__init__() self.toolbar = self.addToolBar('Toolbar') self.widgetAction = QWidgetAction(self.toolbar) self.menu = QMenu(self.toolbar) self.action1 = self.menu.addAction('action1') self.action2 = self.menu.addAction('action2') self.widgetAction.setText('demo') self.widgetAction.setMenu(self.menu) self.toolbar.addAction(self.widgetAction) self.action1.triggered.connect(self.onAction1) self.action2.triggered.connect(self.onAction2) self.widgetAction.triggered.connect(self.triggered) self.setGeometry(300, 300, 300, 200) self.setWindowTitle('Toolbar') def triggered(self, e): if self.widgetAction.text() == 'onAction1': self.action1.trigger() elif self.widgetAction.text() == 'onAction2': self.action2.trigger() def onAction1(self): print('onAction1') self.widgetAction.setText('onAction1') def onAction2(self): print('onAction2') self.widgetAction.setText('onAction2') if __name__ == '__main__': app = QApplication(sys.argv) ex = Example() ex.show() sys.exit(app.exec_())
피드 구독하기:
글 (Atom)
docker redmine 설치
docker-composer.yml version: '3.1' services: redmine: image: redmine restart: always container_na...
-
용량이 큰 파일 업로드 시 net::ERR_CONNECTION_RESET 오류 발생할 경우. http_server = tornado.httpserver.HTTPServer(app, max_buffer_size=10485760000) upload_for...
-
docker-composer.yml version: '3.1' services: redmine: image: redmine restart: always container_na...
-
# !-*- coding:utf-8 -*- import os import sys from PyQt5 import uic from PyQt5.QtCore import Qt from PyQt5.QtWidgets import QDialog , QAppl...