2018년 11월 21일 수요일

[QGIS3] QCalendarWidget

# -*- 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()

댓글 없음:

댓글 쓰기

[python] subprocess

proc.py import asyncio from argparse import ArgumentParser from asyncio import sleep async def process_function(user, file_path):     if use...