python PyGTK 中的插头和插座

发布于 2024-11-17 15:51:38 字数 76 浏览 1 评论 0原文

我刚刚学习 PyGTK,遇到了插头和插座部分。我真的不明白它们的用途 - 谁能给我一个现实生活中的程序示例,其中它们将用于说明它们的用途?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

我要还你自由 2024-11-24 15:51:38

好吧......我似乎找不到任何现实生活中已经存在的应用程序,但我可以想到一个例子(它已经在我的愿望清单和待办事项列表中一段时间​​了)。

假设您正在使用 stackoverflow 并且您想要输入对问题的答复。假设您也是 vim 用户。那么您是否也喜欢能够使用 vim 文本编辑器在这里输入内容。因此,在这种情况下,您可以在浏览器窗口中设置一个小的文本缓冲窗口,您可以使用它来输入长回复,然后将答案转储到网页中的文本框。在这种情况下,您可以创建一个插座和一个插头并构建这样的功能。

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.

无语# 2024-11-24 15:51:38

顺便说一句,我自己正在研究这个问题,所以将我的答案视为“同行学习”,而不是该主题的超级专家的答案。

不太明白它们的用途

基本上它们是用来连接两个不一定属于同一软件的 GUI。想想音乐混音器:建造它的人为它提供了许多插座(插孔端口),然后每个用户都可以插入他们想要的任何乐器(标准插孔)。

在这个比喻中,混音器和乐器都是不同的程序,但它们有一个共同的信号编码方式(gtk.Widget类)来交换程序。

再说一次,我不是专家,但我读到 QT 更广泛地使用了这个概念,还在同一个应用程序内部使用它。

有人能给我一个真实的程序示例吗?可以用它们来说明它们的作用吗?

这里不确定,不过,您可以尝试使用 google 代码搜索

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文