view light9/curvecalc/cursors.py @ 1177:eccb02a704cf

big speedup on graph.contains Ignore-this: 53c970be29bac62467052ba11cedce53
author Drew Perttula <drewp@bigasterisk.com>
date Sun, 15 Jun 2014 07:07:09 +0000
parents 97b028ed0e47
children 7772cc48e016
line wrap: on
line source


import logging
log = logging.getLogger("cursors")

# accept ascii images, read file images, add hotspots, read xbm as
# cursor with @filename form

_pushed = {} # widget : [old, .., newest]
def push(widget,new_cursor):
    global _pushed
    _pushed.setdefault(widget,[]).append(widget.cget("cursor"))

def pop(widget):
    global _pushed
    try:
        c = _pushed[widget].pop(-1)
    except IndexError:
        log.debug("cursor pop from empty stack")
        return
    widget.config(cursor=c)