Reputation: 16533
I'm just learning PyGTK and I came across the plug and sockets section. I don't really understand what they are used for - could anyone give me a real life example of a program where they would be used to illustrate what it is that they do?
Upvotes: 2
Views: 495
Reputation: 43061
Incidentally I'm looking into this myself, so take my answer as "peer learning" not as the one of a super-expert on the subject.
I don't really understand what they are used for
Substantially they are used to connect two GUI that are not necessarily belonging to the same piece of software. Think to a music mixer: the people who built it provided it with a number of sockets (jack ports) and then each user can plug in whatever instrument they wish (standard jacks).
In this metaphor, both the mixer and the music instrument are different program, but they have a common way of encoding the signal (the gtk.Widget class) to exchange programs.
Again, I am not expert, but I read that QT, for example, makes a much more extensive use of this concept, using it also internally to the same application.
could anyone give me a real life example of a program where they would be used to illustrate what it is that they do?
Not sure here, you could try to use google code search, though.
Upvotes: 2
Reputation: 897
Ok ... I can't seem to find any real life application which is already there but I can think of an example( which has been in my wishlist and to-do list since some time now ) .
Suppose you are using stackoverflow and you want to type a reply to a question. And suppose you are also a vim user. So wouldn't you just love to be able to use vim text editor to type here too. So in such a case you can have a small text buffer window in your browser window which you can use to type your long reply and then dump the answer to the text box in the webpage. In such a case you can create a socket and a plug and build such a feature.
Upvotes: 3