【问题标题】:TkInter: how to display the normal cursor?TkInter:如何显示正常光标?
【发布时间】:2022-01-20 04:05:02
【问题描述】:

我有一个简单的 TkInter 界面,单击按钮后,鼠标光标变为 fleur。现在,使用此光标的任务完成后,我想使用普通光标。正常情况下,我指的是您现在在自己的计算机上看到的光标。

我检查了可用游标列表here,但没有一个看起来正常。

有没有办法让鼠标指针回到正常光标?

提前谢谢你

【问题讨论】:

    标签: python tkinter mouse-cursor


    【解决方案1】:

    要返回标准光标,请将空字符串传递给cursor

    root.config(cursor='')
    

    例如:

    from Tkinter import *
    
    def cursor():
        if not root.cget('cursor') == '':
            root.config(cursor='')
        else:
            root.config(cursor='fleur')
    
    root = Tk()
    Button(root, text='Change cursor', command=cursor).pack()
    root.mainloop()
    

    【讨论】:

      猜你喜欢
      • 2018-05-12
      • 1970-01-01
      • 2018-09-22
      • 2015-08-02
      • 2014-10-13
      • 1970-01-01
      • 2012-01-24
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多