qt-designer

PyQt get date from the user

巧了我就是萌 提交于 2020-08-19 14:02:47
问题 I built simple widget in Qt Designer with a button and a QDateEdit. The user will enter the date into the QDateEdit and then when he presses the button, the date will be saved to a variable. How can I do it? 回答1: You can make it simply: var_name = self.dateEdit.date() This will get you a variable in QDate format. If you need it in a format which would be easier to work with then you should use this: temp_var = self.dateEdit.date() var_name = temp_var.toPyDate() The first one gives you: "PyQt4