使用 pyglet 和 ScrollableTextLayout 渲染和滚动多行段落
如何使用 ScrollableTextLayout 的功能通过 pyglet 显示和滚动多行字符串(包含“\n”)?
但是我不知道如何使用它。这些文档并没有向我解释太多。
SomeText:
string = "Some multiline \n text is contained within this string \n which must be rendered \n such that it is able to be scrolled through."
感谢片段/链接。
How can one display and scroll through a multi-line strings (contain "\n") via pyglet using the features of ScrollableTextLayout?
STL crops what is display, and seems to be the most efficient way to implement scrolling.
However I have no idea as to how to use it. The docs do not elucidate much to me.
SomeText:
string = "Some multiline \n text is contained within this string \n which must be rendered \n such that it is able to be scrolled through."
Snippets/Links are appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以像这样创建一个:
并使用 view_x 和 view_y 值选择滚动位置。
设置不同的view_y值来垂直滚动。
You create one like this:
And you choose your scroll position with the view_x and view_y values.
Set different values of view_y to scroll vertically.