在 gnome Applet 中添加 gtk.widget

发布于 2024-09-01 20:13:26 字数 452 浏览 6 评论 0原文

我有一个问题:

我写了一个小 gnome 小程序,当我们单击一个按钮时,我想在“gnome-panel”下添加一个 gtk.widget,就像时钟小程序的日历一样。

但我不知道该怎么做。 这是我的代码:

listButton = gtk.Button(_("lastest"))
self.listTwitt = gtk.TreeView()
mainLayout = gtk.VBox()
mainLayout.pack_start(listButton)
mainLayout.pack_start(self.listTwitt)
self.applet.add(mainLayout)

使用此代码,当我单击按钮时,列表会显示在 gnome 面板中:这是因为我将其添加到 mainLayout 中。

那么如何将其添加到“gnome-panel”下。

谢谢

I have a question :

I write a little gnome applet, and when we click on a button i want to add a gtk.widget under the "gnome-panel" like the calendar of the clock-applet.

But I don't know how to do this.
It's my code :

listButton = gtk.Button(_("lastest"))
self.listTwitt = gtk.TreeView()
mainLayout = gtk.VBox()
mainLayout.pack_start(listButton)
mainLayout.pack_start(self.listTwitt)
self.applet.add(mainLayout)

With this code, when i click on the button, the list shows up in the gnome panel : it's because I add it in the mainLayout.

So how do I add it under the "gnome-panel".

Thanks

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

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

发布评论

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

评论(1

最佳男配角 2024-09-08 20:13:26

您必须创建一个gtk.Window,将其放置在小程序下,然后将其添加到其中。

You have to create a gtk.Window, position it under the applet, and add it in there.

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