-
Notifications
You must be signed in to change notification settings - Fork 1
List of Cursors
The Goopy library currently supports all the cursors supported by Tkinter and does not support custom cursors.
To use these cursors on a graphics object, simply type the name (string given next to the thumbnails) of the cursor into the cursor parameter of the graphic object (detailed more in the GraphicsObject Wiki):
from goopy.objects.Rectangle import Rectangle
from goopy.GraphWin import GraphWin
from goopy.Point import Point
window = GraphWin(title="Cursor Example", width=600, height=600, autoflush=False)
rect = Rectangle(Point(100, 100), Point(500, 500), cursor="select").draw(window)
while True:
window.update_win()This code makes the cursor change to the select hand whenever you hover over the rectangle and back to an arrow when you don't. The arrow is the default cursors.
![]()
Goopy also has some cursors that change automatically, take this for example:
from goopy.objects.Rectangle import Rectangle
from goopy.GraphWin import GraphWin
from goopy.Point import Point
window = GraphWin(title="Cursor Example", width=600, height=600, autoflush=False)
rect = Rectangle(Point(100, 100), Point(500, 500), cursor="select").draw(window)
rect.set_resizable(top=True, bottom=True, left=True, right=True)
while True:
window.update_win()This code is exactly the same as the previous, except we tell Goopy that we want to be able to resize the rectangle in all 4 directions. Thus, when you hover over an edge of the rectangle, the cursor changes:
![]()
Here is a list of Cursors with their thumbnails:
-
arrow (default) -
small-arrow -
question-arrow -
flipped-pointer -
flipped-arrow -
thin-flipped-arrow -
pointer-arrow -
rotating-arrow
-
select -
x -
move -
crosshair -
text-cursor -
loading
based-down-arrow
based-up-arrow
-
bottom-left-corner
bottom-left-corner-arrow -
bottom-right-corner
bottom-right-corner-arrow -
top-left-corner
top-left-corner-arrow -
top-right-corner
top-right-corner-arrow
top-t
bottom-t
left-t
right-t
up-arrow
up-arrow-thin
down-arrow
left-arrow
right-arrow
double-arrow
horizontal-resizing-arrow
vertical-resizing-arrow
sizing
top-download
download
left-download
right-download
plus
diamond-plus
inverted-plus
t-cross
circle
donut
heart
box
target
spiral
diamond-box
blackbox
iron-cross
left-button
right-button
middle-button
mouse
bird
boat
sailboat
clock
maze
maze-symbol
mug
shuttle
pencil
pirate
diamond-plus
spider
star
stickman
spraycan
umbrella
virus
volcano
pointer
Feel free to use this library in any of your projects and let me know about them!
Contact Author: bhavyemathur@gmail.com