Skip to content

Commit

Permalink
add set_cursor method #107
Browse files Browse the repository at this point in the history
  • Loading branch information
kujirahand committed Dec 21, 2024
1 parent aed1771 commit fbdbdd2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
5 changes: 5 additions & 0 deletions TkEasyGUI/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@
ReliefType = Literal["flat", "groove", "raised", "ridge", "solid", "sunken"]
KeyType = Union[str, int]
ColorFormatType = Literal["html", "rgb", "tuple"]
CursorType = Literal["arrow", "circle", "cross", "dotbox", "exchange", "fleur",
"hand1", "hand2", "heart", "man", "mouse", "pirate", "plus",
"shuttle", "sizing", "spider", "spraycan", "star", "target",
"tcross", "trek", "watch", "xterm", "ibeam", "wait",
"size", "size_all", "size_nw_se", "size_ne_sw", "size_we", "size_ns"]

# -------------------------------------------------------------------
# clipboard
Expand Down
6 changes: 6 additions & 0 deletions TkEasyGUI/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
from . import dialogs, utils, version
from .utils import (
# type alias
CursorType,
EventMode,
FontType,
ListboxSelectMode,
Expand Down Expand Up @@ -1269,6 +1270,11 @@ def get(self) -> Any:
def update(self, *args, **kw) -> None:
"""update widget configuration."""
pass

def set_cursor(self, cursor: CursorType) -> None:
"""Set the cursor."""
if self.widget is not None:
self.widget.config(cursor=cursor)

def _widget_update(self, **kw) -> None:
# update element's props
Expand Down

0 comments on commit fbdbdd2

Please sign in to comment.