[英]GTK3 label scrollbar Python
Here is notebook code with gtk3 python. 这是带有gtk3 python的笔记本代码。
#!/usr/bin/python
# -*- coding: utf-8 -*-
from gi.repository import Gtk
window = Gtk.Window(title="Notebook")
window.set_default_size(600, 360)
window.connect("destroy", lambda q: Gtk.main_quit())
notebook = Gtk.Notebook()
window.add(notebook)
notebook.set_tab_pos(Gtk.PositionType.LEFT)
label0 = Gtk.Label() # need here scrollbar
label1 = Gtk.Label() # need here scrollbar
label0.set_text("First text inside")
label1.set_text("Second text inside")
notebook.append_page(label0)
notebook.append_page(label1)
notebook.set_tab_label_text(label0,"First tab title")
notebook.set_tab_label_text(label1,"Second tab title")
notebook.set_tab_reorderable(label1, False)
label0.set_alignment(0.0,0.0)
label1.set_alignment(0.0,0.0)
window.show_all()
Gtk.main()
How to add scrollbar on Labels? 如何在标签上添加滚动条? Not in main window or main container, but only in labels, where are "First Text inside, Second text inside" labels.
不在主窗口或主容器中,而仅在标签中,“第一文本在里面,第二文本在里面”标签中。
Gtk.Notebook
doesn't support that. Gtk.Notebook
不支持。 If there are too many tab labels to fit in the space, then it will add arrows for paging through the tabs; 如果选项卡标签太多而无法容纳在该空间中,则它将添加用于在选项卡中分页的箭头; I'm assuming that's not what you want.
我以为那不是您想要的。
Instead, use Gtk.StackSidebar
with Gtk.Stack
(GTK 3.16 or later). 而是将
Gtk.StackSidebar
与Gtk.Stack
(GTK 3.16或更高版本)一起使用。 If you have 3.10 or later, you can still use Gtk.Stack
but you will have to build your own replacement for Gtk.StackSidebar
which you can probably do quite easily with Gtk.ListBox
. 如果您使用的是3.10或更高版本,则仍然可以使用
Gtk.Stack
但是您必须构建自己的Gtk.StackSidebar
替代Gtk.StackSidebar
,您可以使用Gtk.ListBox
轻松地进行Gtk.ListBox
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.