On 26 Oct 2016, at 10:36 am, luca72 via Python-list <python-list@python.org> wrote: > > Hello i hope that yo can reply to this question also if the argument is pyqt > > i have a simple test: > def start_timer(self): > self.timer = QTimer() > testo = 'pressed' > self.timer.singleShot(1000, self.metto_testo) > > def test(self, testo): > self.lineEdit.setText(testo) > > > How i can pass the variable testo to the def test? > If i use : > self.timer.singleShot(1000, self.metto_testo(testo) > i get error
Use a lambda... self.timer.singleShot(1000, lambda s: self.metto_testo(testo)) Phil -- https://mail.python.org/mailman/listinfo/python-list