【问题标题】:Didn't found any documentation for tkEntrySeeInsert没有找到 tkEntrySeeInsert 的任何文档
【发布时间】:2015-12-30 06:03:48
【问题描述】:

我在TK编程的很多地方都发现了tkEntrySeeInsert %W

但是找不到任何合适的文档。 tkEntrySeeInsert 究竟做了什么?

【问题讨论】:

    标签: tkinter tcl tk


    【解决方案1】:

    它滚动条目小部件的内容,以便插入光标可见。

    【讨论】:

      【解决方案2】:

      它没有被记录,因为它是 Tk 实现的一部分,而不是 Tk 的接口。它在 Tk 8.5 中将名称更改为 ::tk::EntrySeeInsert - 不是宣布的更改本身 - 正是因为它是 Tk 工作方式的内部。

      它的实现和内部文档注释(来自 Tk 8.6)是这样的:

      # ::tk::EntrySeeInsert --
      # Make sure that the insertion cursor is visible in the entry window.
      # If not, adjust the view so that it is.
      #
      # Arguments:
      # w -           The entry window.
      
      proc ::tk::EntrySeeInsert w {
          set c [$w index insert]
          if {($c < [$w index @0]) || ($c > [$w index @[winfo width $w]])} {
              $w xview $c
          }
      }
      

      如果您知道 @x 样式的索引的作用可能会有所帮助:它们从(水平)小部件级屏幕坐标转换为字符索引。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2019-06-29
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2019-02-14
        相关资源
        最近更新 更多