For a built-in dialog like QInputDialog, I've read that I can do this:
text, ok = QtGui.QInputDialog.getText(self, 'Input Dialog', 'Enter your name:')
How can I emulate this behavior using a dialog that I design myself in Qt Designer? For instance, I would like to do:
my_date, my_time, ok = MyCustomDateTimeDialog.get_date_time(self)
Here is simple class you can use to prompt for date:
and to use it:
I tried to edit the answer of hluk with the changes below but it got rejected, not sure why because it got some clear bugs as far is I can see.
bugfix 1: removed self. from self.layout.addWidget(self.buttons)
bugfix 2: connected OK and Cancel buttons to its correct actions
enhancement: made the code ready to run by including the imports and improved the run example
and to use it: