我正在为 ubuntu 做一个小型 RSS 新闻应用程序。我使用创建了一个笔记本
notebook=gtk.Notebook()
win.add(notebook)
label1=gtk.Label()
label1.set_text("one")
notebook.append_page(label1,label1)
我有这个带有 hbox、vbox 和滚动条的代码。
box1=gtk.VBox()
win.add(box1)
box2=gtk.HBox()
box1.pack_start(box2)
addressbar=gtk.Entry()
box2.pack_start(addressbar)
gobutton=gtk.Button("GO")
box2.pack_start(gobutton)
gobutton.connect('clicked',gob)
scroller=gtk.ScrolledWindow()
box1.pack_start(scroller)
web=webkit.WebView()
scroller.add(web)
如何将第二个代码添加到第一个代码的笔记本选项卡中?
最佳答案
您只需将box1
放入当前Notebook页面,而不是将其放入win
。
label1 = gtk.Label("one")
box1 = gtk.VBox()
notebook = gtk.Notebook()
notebook.append_page(box1, label1)
win.add(notebook)
box2 = gtk.HBox()
box1.pack_start(box2)
#etc
顺便说一句,我没有看到您在小部件上调用 .show
方法;我假设您在创建完所有内容后会调用 win.show_all
。
关于python - 如何将 hboxes 和 vboxes 代码添加到 python gtk 中的笔记本选项卡,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35684152/