On 5 July 2010 21:48, A.T.Hofkamp <a.t.hofk...@tue.nl> wrote: > I was mostly triggered by the fact that you are doing asynchronous > activities next to the GTK application, which are apparently complicated > enough to use threads for.
It's not complicated, there's simply a time consuming operation involved. > About not mentioning guis: > If you write a spread sheet program, and explain its features, you don't > explain that you can add two numbers, do you? Yes, but if it can do arbitrary precision arithmetic, you might mention that feature, even though it's *obviously* a *trivial* extension of the ability to do batch computation :P It's somewhat counter-intuitive to have a module named "twisted.internet" that can be used for things that have nothing to do with the internet. It makes a potential programmer think, "I don't really want a full blown internet stack just for a quick and simple desktop app." Just like I don't open up a spreadsheet just to add two numbers, even though it's technically capable of that. But fine, it's just a name, I can ignore it. > I completely agree with you that this is a weak point. > I found the best source of information to be their howtos and > tutorials/examples, to get the global picture, and the API documentation > (for the protocols, mostly). I'll poke around, thanks. > Basically, asynchronous communication means you are doing event-based > programming everywhere. I like that idea. I understand the principle. It's mainly how I use GTK, where possible. > From this point of view, it is totally irrelevant what event you get (a > network comm event, a GUI event, or something from another source), only the > actual handler of the event needs to know details of the event. Yes, but the *details* are what I need to know. How do I write a "file processor" model: something that takes a filename, returns a initial status immediately, and then X minutes later returns the result of processing the file? In fact, ignore that, how do I write a class that does "time.sleep(100)" and then sends a signal saying that it's done? > http://twistedmatrix.com/documents/current/core/howto/choosing-reactor.html#auto11 > > That page also refers to an example "doc/core/examples/pbgtk2.py" ...which still seems to involve some sort of network communication, which is extra noise that just gets in the way of understanding the GTK interaction. > In the same way, Twisted does not care about the comm protocol use to > deliver the event. Whether a user pressed a button at a web-form, or sent a > IRC message does not matter for computing the response. If Twisted doesn't care about the protocol, why can't I find a single example that does not involve a network-based protocol? > I am not sure why there is so little nice introductory information. I think > it is because the gap between both worlds is so big. Either you don't get > it, and then you cannot write about it due to lack of understanding, or you > do get it, and then you cannot imagine how to explain it to somebody that > doesn't. It's not about "getting" event based programming. Take this very email, for example. You go on at length about the architectural principles of Twisted. But in a tenth of the space I could have written an illustrative example of using GTK+ with Python threads to do asynchronous activity (now). Why can't anyone just do that with Twisted instead of writing essays? What letters do I type to get anything done? Nothing I have read so far has given me any hint about this. > (Like programming, can you explain the essence of what programming is, to > somebody that has no clue about computers?) You could actually show them a computer, and show them the things it can do, and then show them how to do the things they want to do with it. That's how I would start. Thanks for the pointers though. If I ever find the time, I'll try it out. — Jason _______________________________________________ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://faq.pygtk.org/