import sys
from PyQt4 import QtGui, QtCore
class Example(QtGui.QWidget):
def __init__(self):
super(Example, self).__init__()
self.initUI()
def initUI(self):
cal = QtGui.QCalendarWidget(self)
cal.setGridVisible(True)
cal.move(20, 20)
cal.clicked[QtCore.QDate].connect(self.showDate)
self.lbl = QtGui.QLabel(self)
date = cal.selectedDate()
self.lbl.setText(date.toString())
self.lbl.move(130, 260)
self.setGeometry(300, 300, 350, 300)
self.setWindowTitle('Calendar')
self.show()
def showDate(self, date):
self.lbl.setText(date.toString())
def main():
app = QtGui.QApplication(sys.argv)
ex = Example()
sys.exit(app.exec_())
if __name__ == '__main__':
main()
このコードは、日付が表示されたカレンダーウィジェットを生成します。ユーザー入力を介して関連する日付にいわゆる予定を添付し、その日付に添付された予定があること、つまり日付が赤くなることをユーザーに表示できるようにする必要があります
また、すべての予定をリスト (またはテキスト ファイル) にまとめて、ユーザーが必要に応じて一度にすべての予定を表示できるようにすると便利です。
前もって感謝します