Tkinter文本小部件搜索和sh

2024-05-20 00:04:27 发布

您现在位置:Python中文网/ 问答频道 /正文

我能够创建一个带有搜索的文本小部件,并突出显示每个发现。我唯一错过的是一个类似“Next”的按钮,它会跳转到下一个搜索结果。 到目前为止,我连第一个发现都看不出来。 我可以把光标移到那里,但我不能移动屏幕。在

文本小部件有大量的文本,如果可以的话,我使用滚动条。在

有没有办法把屏幕或滚动条移到curzor?还是贴标签?还是一个发现?在

谢谢,哥波


Tags: 文本屏幕部件按钮next光标办法贴标签
1条回答
网友
1楼 · 发布于 2024-05-20 00:04:27

您可以调用yview方法以特定数量滚动小部件。但是,对于这个特定的用例,文本小部件有see方法,它安排给定索引可见。在

从官方的tcl/tk文档(Tkinter的构建基础上):

[see] Adjusts the view in the window so that the character given by index is completely visible. If index is already visible then the command does nothing. If index is a short distance out of view, the command adjusts the view just enough to make index visible at the edge of the window. If index is far out of view, then the command centers index in the window.

相关问题 更多 >