python - PyQt5 - 默认日期时间为 QDateTimeEdit

标签 python pyqt5

我想在 QDateTimeEdit() 中添加一个从现在开始 + 7 天的默认日期。

我发现 setDateTime 函数我做不到

dateTimeBegin.setDateTime(datetime.now+7)

或者类似的东西

希望你能帮助我。

提前致谢

最佳答案

尝试以下操作:

currentTime = QDateTime.currentDateTime()
dateTimeBegin.setDateTime(currentTime.addDays(7))

关于python - PyQt5 - 默认日期时间为 QDateTimeEdit,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54590150/

相关文章:

python - Django-Guardian - 限制组对类的访问

python - 尝试在 Azure 中使用 matplotlib 时出现 "ModuleNotFoundError: No module named ' tkinter '"

python - 如何更新QWidget的内容?

Python PyQt5 : QListWidget doesn't accept drops

python - 使用 Pynsist 和 PyQt 构建的 GUI : Import Error 'sip'

python - 从 db.Key 派生 db.Model 子类

Python - 将 2 个类导入主文件

python-3.x - PyQt5 弹出窗口

python - 如何在 QScintilla 中使用自定义折叠图标?

python - 跨多个表的 SQLAlchemy 关系