The solution to my problem is probably very simple, but I am having great problems solving it.
I have a MainWindow Class calling a Dialog. I send the contents of a list from a loop to the Dialog lineEdit for a user to accept or change as required and return the result.
Here is the snippits of code:
class TrackTitles(QDialog,ui_Dialog_2.Ui_Dialog):
def __init__(self, TrackNames, parent=None):
super(TrackTitles, self).__init__(parent)
self.TrackNames = TrackNames
self.setupUi(self)
self.NewTrackTitle = None
self.connect(self.btn_Cancel, SIGNAL("clicked()"),self.close)
self.connect(self.btn_OK, SIGNAL("clicked()"),self._accept)
self.connect(self.lineEdit, SIGNAL("returnPressed()"), self._accept)
self.connect(self.btn_Reset, SIGNAL("clicked()"),self._reset)
self.TrackNo = self.TrackNames[0]
self.CurrentTrackTitle = self.TrackNames[1]
self.lineEdit.setText(self.CurrentTrackTitle)
def _accept(self):
self.NewTrackTitle = self.lineEdit.text()
def _reset(self):
print 'RESET Code here'
return
###################################################################################
class MainWindow(QMainWindow,ui_music.Ui_MainWindow):
############ Lots of code here
for no,trak in enumerate(self.trackTitles):
Dlg = TrackTitles([str(no+1),trak],self)
print 'NewTrackTitle ',Dlg.NewTrackTitle
The result is a load of None's - this could be a habit.
Tkinter has a wait_window facility. Is there any way to cause the TrackTitle to wait for the OK button to be clicked before returning?
Thank you in anticipation.
Graham