如何在python3中設置Gtk.ScrolledWindow的垂直調整?這是一個演示問題的例子。如何設置Gtk.ScrolledWindow調整
#!/usr/bin/env python3
from gi.repository import Gtk
class window:
def __init__(self):
win = Gtk.Window()
win.connect("delete_event", Gtk.main_quit)
win.set_default_size(300,100)
scroll = Gtk.ScrolledWindow(None, None)
view = Gtk.Viewport(None, None)
label = Gtk.Label('a\n\n\n\n\nb\n\n\n\n\n\n\n\nc')
view.add(label)
scroll.add(view)
position = Gtk.Adjustment(value=50)
scroll.set_vadjustment(position)
win.add(scroll)
win.show_all()
if __name__ == '__main__':
win = window()
Gtk.main()
你能否提供一些代碼是如何做到這一點在我上面顯示的例子嗎? – elya5