Skip to content

Instantly share code, notes, and snippets.

@typemytype
Last active November 18, 2019 14:23
Show Gist options
  • Select an option

  • Save typemytype/bb7d970cb5ec69e87c75fc2e5e0145f5 to your computer and use it in GitHub Desktop.

Select an option

Save typemytype/bb7d970cb5ec69e87c75fc2e5e0145f5 to your computer and use it in GitHub Desktop.
from mojo.events import addObserver
class SuperZoom(object):
def __init__(self):
addObserver(self, "keyDown", "keyDown")
def keyDown(self, notification):
view = notification["view"]
event = notification["event"]
characters = event.characters()
factor = 5
if characters == "Z": # shift + z
view.zoomIn(factor)
elif characters == "X": # shift + x
view.zoomOut(1 / factor)
SuperZoom()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment