<span class="gmail_quote"><br></span>Date: Sun, 21 Jan 2007 19:36:48 +0100<br>From: David Boddie <<a href="mailto:david@boddie.org.uk" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">david@boddie.org.uk
</a>><br>Subject: Re: [PyKDE] callback not being called
<br>To: <a href="mailto:pykde@mats.imk.fraunhofer.de" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">pykde@mats.imk.fraunhofer.de</a><br>Message-ID: <<a href="mailto:200701211936.48640.david@boddie.org.uk" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
200701211936.48640.david@boddie.org.uk</a>><br>Content-Type: text/plain; charset="iso-8859-1"<br><br>On Sunday 21 January 2007 09:05:40 -0800, Tony Cappellini wrote:<br><br>>>Do you mean that you want to call normal methods in Python classes and not
<br>j>>ust those supplied by their Qt base classes?<br>Yes<br><br>>>You should be able to use the same syntax as that used in the Qt documentation, but there's also a PyQt-specific shortcut for slots that you can use.
<br>Well, the QT docs are all in C++, and often there are some differences for python.<br>I've read the pyQT docs here, but it's very terse, and doesn't provide examples.<br><a href="http://www.riverbankcomputing.com/Docs/PyQt4/pyqt4ref.html#pyqt-slots-and-qt-slots" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
http://www.riverbankcomputing.com/Docs/PyQt4/pyqt4ref.html#pyqt-slots-and-qt-slots</a><br>(this is the only python-specific help I can find. It's only one page)<br><br><h2><a href="http://www.riverbankcomputing.com/Docs/PyQt4/pyqt4ref.html#id14" name="11047aff5f293497_connecting-signals-and-slots" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
3.5 Connecting Signals and Slots</a></h2>
<p>Connections between signals and slots (and other signals) are made using the
<tt><span>QtCore.QObject.connect()</span></tt> method. For example:</p>
<pre>QtCore.QObject.connect(a, QtCore.SIGNAL("QtSig()"), pyFunction)<br>QtCore.QObject.connect(a, QtCore.SIGNAL("QtSig()"), pyClass.pyMethod)<br>QtCore.QObject.connect(a, QtCore.SIGNAL<br>("QtSig()"), b,
QtCore.SLOT("QtSlot()"))<br>QtCore.QObject.connect(a, QtCore.SIGNAL("PySig()"), b, QtCore.SLOT("QtSlot()"))<br>QtCore.QObject.connect(a, QtCore.SIGNAL("PySig"), pyFunction)<br><br></pre>
<br> def updateTextBox(self):<br> # this function should be called, when the button is pressed<br> self.patchBrowser.setPlainText(self.tr("Callback was called"))<br><br>>>However, your updateTextBox() slot is just a normal Python method, so you can just pass a reference to it:
<br><br> >>self.connect(self.patchNames, QtCore.SIGNAL("activated()"), self.updateTextBox)<br>I've tried this, my function still isn't being called<br><br>>>For slots defined by the C++ base class, you can use SLOT() to specify them in the connect() call;
<br>>>for example, the following connection would cause the dialog to be hidden when a patchNames combobox entry is activated:<br><br> >>self.connect(self.patchNames, QtCore.SIGNAL("activated()"), self,
QtCore.SLOT("hide()"))<br>I've tried this too, it doesn't call my function either<br><br><br>