참조 :
http://lazka.github.io/pgi-docs/Gtk-3.0/classes/TreeView.html#Gtk.TreeView.scroll_to_cell는 "add_with_viewport"으로 스크롤 창에 트 리뷰 추가하지 마십시오. http://mailman.daa.com.au/cgi-bin/pipermail/pygtk/2009-January/016440.html
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
class MyWindow(Gtk.Window):
def __init__(self):
Gtk.Window.__init__(self, title="Auto Scroll")
self.set_size_request(400, 200)
self.liststore = Gtk.ListStore(str, str)
for n in range(40):
self.liststore.append(["Info", "http://lazka.github.io/pgi-docs/Gtk-3.0/classes/TreeView.html"])
treeview = Gtk.TreeView(model=self.liststore)
for n, name in enumerate(["Name", "Link"]):
renderer_text = Gtk.CellRendererText()
column_text = Gtk.TreeViewColumn("Text", renderer_text, text=n)
treeview.append_column(column_text)
scrolled_window = Gtk.ScrolledWindow()
self.add(scrolled_window)
scrolled_window.add(treeview)
def main(self):
Gtk.main
win = MyWindow()
win.connect("delete-event", Gtk.main_quit)
win.show_all()
Gtk.main()