Kalender widget

Op deze pagina:

    Je kunt een kalender op het scherm zetten als datumkiezer.

    
    #!/usr/bin/python3
    # -*- coding: utf-8 -*-
    
    import sys
    
    from PyQt5.QtWidgets import QApplication, QWidget, QLabel, QCalendarWidget
    from PyQt5.QtCore import QDate
    
    class Venster (QWidget):
    
        def __init__(self):
            super(Venster , self).__init__()
    
            self.initUI()
    
        def initUI(self):
    
            cal = QCalendarWidget(self)
            cal.setGridVisible(True)
            cal.move(20, 20)
            cal.resize(320,240)
            cal.clicked[QDate].connect(self.showDate)
    
            self.datum = QLabel(self)
            date = cal.selectedDate()
            self.datum.setText(date.toString())
            self.datum.move(130, 270)
    
            self.setGeometry(400, 400, 360, 300)
            self.setWindowTitle('Kalender')
            self.show()
    
        def showDate(self, date):
    
            self.datum.setText(date.toString())
    
    def main():
    
        app = QApplication(sys.argv)
        window = Venster ()
        sys.exit(app.exec_())
    
    if __name__ == '__main__':
        main()
    

    kalender datum kiezer

     

    Verwante artikelen