|
Hi, I am having difficulty with using signal handlers. I am using Glade 2 and Pygtk. My
editor is Pythoncard. The following code connects to button
one and calls a function which hides button one. self.wTree = gtk.glade.XML ("phonelog.glade",
"window1") dic={"on_window1_destroy"
: self.quit, } self.wTree.signal_autoconnect (dic) process = self.wTree.get_widget("button1") process.connect("clicked",
self.callback1, start_date, process) def callback1(self,data,start_date,process): process.hide() The above code works fine. However I want button one to remain on
my GUI. Thus, I want to just stop the
signal being emitted after it is pressed once. I have used the following code which is
trying to disconnect the button one: self.wTree = gtk.glade.XML ("phonelog.glade",
"window1") dic={"on_window1_destroy"
: self.quit, } self.wTree.signal_autoconnect (dic) process = self.wTree.get_widget("button1") process.connect("clicked",
self.callback1, start_date, process) def callback1(self,data,start_date,process): process.disconnect() When I run this code I get the error TyoeError: Object takes exactly one argument(0 given) When I put an argument in, it says that the argument must be
an integer. I have tried a number
of integers at random but none work.
On the Pygtk tutorial it states the following: Lets take another look at the connect() call.
The return value from a connect() call is an integer tag that identifies your callback.
As stated above, you may have as many callbacks per signal and per object as
you need, and each will be executed in turn, in the order they were attached. This tag allows you to remove this callback
from the list by using:
So, by passing in the tag returned by one of
the signal connect methods, you can disconnect a signal handler. How do I find out what the integer tag
is, so that I can put this in my code? I have tried the pygtk faq page but it
is currently unavailable. Any help greatly appreciated. Thanks, John. |
_______________________________________________ Tutor maillist - [email protected] http://mail.python.org/mailman/listinfo/tutor
