如何从 python 代码中滚动 gtk.scrolledwindow 对象
我正在编写一个带有glade gui 的python 应用程序。使用subprocess在后台执行一些shell命令。
使用一个有一个滚动窗口小部件和滚动窗口小部件内的文本视图小部件的空地 GUI。当 subprocess.Popen 对象运行时,文本视图将被填充,并将其 stdout 和 stderr 显示到此文本视图。
我的问题是,textview 不断填充,但在滚动位置 0, 0(最顶部、最左侧)处保持静止,
我希望此滚动窗口小部件始终保持在最底部、最左侧...
是否有人知道我需要调用哪种方法来向下滚动这个东西吗?
I'm writing a python application that has a glade gui. Using subprocess to execute some shell commands in the background.
Using a glade GUI which has a scrolledwindow widget and a textview widget inside the scrolledwindow widget. The textview gets populated as the subprocess.Popen object run and display their stdout and stderr to this textview.
My problem is that the textview is constantly populated, but stays still @ scroll position 0, 0 (top-most, left-most)
I want this scrolledwindow widget to stays at bottom-most, left-most at all times...
Does anyone have any idea which method I need to call scroll this thing downwards?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您需要从滚动窗口获取水平和/或垂直 gtk.Adjustment,并更改其值。请参阅
set_all
方法gtk.Adjustment 可能就是您想要的。You need to get the horizontal and/or vertical gtk.Adjustment from the scrolledwindow, and change its values. See
The
set_all
method of gtk.Adjustment is probably what you want.这可能就是您正在寻找的。
http://faq.pygtk.org/index.html py?req=show&file=faq14.010.htp
This is probably what you are looking for.
http://faq.pygtk.org/index.py?req=show&file=faq14.010.htp
看看
gtk.ScrolledWindow.set_placement
。(从未尝试过)
look at
gtk.ScrolledWindow.set_placement
.(never tried)