当前位置: 首页 > 文档资料 > Python 中文教程 >

Cursors

优质
小牛编辑
124浏览
2023-12-01

Python Tkinter支持许多不同的鼠标光标。 具体图形可能因操作系统而异。

以下是有趣的列表 -

  • "arrow"
  • "circle"
  • "clock"
  • "cross"
  • "dotbox"
  • "exchange"
  • "fleur"
  • "heart"
  • "heart"
  • "man"
  • "mouse"
  • "pirate"
  • "plus"
  • "shuttle"
  • "sizing"
  • "spider"
  • "spraycan"
  • "star"
  • "target"
  • "tcross"
  • "trek"
  • "watch"

例子 (Example)

通过在不同按钮上移动光标来尝试以下示例 -

from Tkinter import *
import Tkinter
top = Tkinter.Tk()
B1 = Tkinter.Button(top, text ="circle", relief=RAISED,\
                         cursor="circle")
B2 = Tkinter.Button(top, text ="plus", relief=RAISED,\
                         cursor="plus")
B1.pack()
B2.pack()
top.mainloop()