我想在点击它时画出日期。这是代码: 日期 - 我要绘制的对象。希望得到帮助...
class Example(QtGui.QWidget):
def __init__(self):
super(Example, self).__init__()
self.initUI()
def initUI(self):
cal = QtGui.QCalendarWidget(self)
cal.setGridVisible(True)
cal.clicked[QtCore.QDate].connect(self.showDate)
self.lbl = QtGui.QLabel(self)
date = cal.selectedDate()
self.lbl.setText(date.toString())
self.lbl.move(130, 150)
self.setGeometry(50, 50, 500, 400)
self.setWindowTitle('Calendar')
self.resize(500,400)
self.show()
def showDate(self, date):
self.lbl.setText(date.toString())
print date
print str(date.day()) + "/" + str(date.month()) + "/" + str(date.year()