Tkinter 光标



Python Tkinter 支持相当数量的不同可用鼠标光标。确切的图形可能因您的操作系统而异。

以下是有趣的光标列表:

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

示例

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

from tkinter import *
import tkinter

top = Tk()
B1 = Button(top, text ="circle", relief=RAISED,\ cursor="circle")
B2 = Button(top, text ="plus", relief=RAISED,\ cursor="plus")

B1.pack()
B2.pack()
top.mainloop()
python_gui_programming.htm
广告