I'm just starting out with twisted, and it's a very impressive framework. I'm still learning the concepts though, and feel like I'm missing something important. I get the idea of deferred callbacks, but there are cases where I'd like to implement something directly and I cannot figure out how to accomplish this.
I'm attempting to write an application based on the example found here: http://twistedmatrix.com/projects/words/documentation/examples/oscardemo.py
The example I can understand perfectly, I can see how it creates the deferred callback and runs through the reactor, and I can tweak it to my heart's content. But that is targeted as a client but in a server-side operation like a bit. Instead, what happens if you are writing a program that requires user input? In the example, the program is run by the reactor and it depends on external input to cause the callbacks and generate activity.
Grr.. it seems like I'm talking in circles, and I'm probably using the wrong terminology. What I'm trying to do is access the "sendMessage" function of the oscardemo.py from outside that class. I have functionality in a GTK2 window that is intended to send a message using oscar, but I cannot figure out how to take advantage of the protocol.ClientCreator to do that. If I assign a variable to protocol.ClientCreator it tells me it is a Deferred OscarAuthenticator, but I cannot make the mental leap to figure out how to manipulate that in order to send messages. It seems that I should be using callbacks since it is deferred, but I can't see how I'd do that to accomplish my goals.
Is using ClientCreator the wrong step for me here, or does that provide the sort of functionality I am looking for? If I need to RTFM, can someone point me at the correct manual to read? I've read the HOWTOs on deferred and can only seem to get information about callbacks and I can't figure out how to use callbacks to provide user-supplied messages.
Sorry for my lack of clarity, as I said I'm still quite new at this.