# File : mypython.pyimport sysfrom PyQt4 import QtGui, QtCorefrom myCalendar import Ui_myCalendar# We start a new class here# derived from QMainWindowclass TestApp(QtGui.QMainWindow): def __init__(self): QtGui.QMainWindow.__init__(self) self.ui = Ui_myCalendar() myWidget = QtGui.QWidget() self.ui.setupUi(myWidget) self.setCentralWidget(myWidget) self.ui.myLabel.setText("") # Connect the calendar to show the date on the QLabel self.connect(self.ui.calendarWidget, QtCore.SIGNAL('selectionChanged()'), self.showDate)def showDate(self): date = self.ui.calendarWidget.selectedDate() self.ui.myLabel.setText(str(date.toPyDate()))if __name__ == "__main__": app = QtGui.QApplication(sys.argv) window = TestApp() window.show() sys.exit(app.exec_())