mojo.canvas

class CanvasGroup()

A vanilla object that sends all events to a given delegate.

all events a delegate could have that can be used:

  • draw()
  • becomeFirstResponder(event)
  • resignFirstResponder(event)
  • mouseDown(event)
  • mouseDragged(event)
  • mouseUp(event)
  • mouseMoved(event) (only when acceptsMouseMoved is set True)
  • rightMouseDown(event)
  • rightMouseDragged(event)
  • rightMouseUp(event)
  • mouseEntered(event)
  • mouseExited(event)
  • scrollWheel(event)
  • magnifyWithEvent(event)
  • rotateWithEvent(event)
  • swipeWithEvent(event)
  • keyDown(event)
  • keyUp(event)
  • flagChanged(event)
  • menu(event)
from mojo.canvas import CanvasGroup
from mojo.drawingTools import *
from vanilla import Window

class ExampleWindow:

    def __init__(self):
        self.w = Window((400, 400), minSize=(200, 200))
        self.w.canvas = CanvasGroup((0, 0, -0, -0), delegate=self)
        self.w.open()

    def draw(self):
        rect(10, 10, 100, 100)

ExampleWindow()
Inherits from subclass: mojo.canvas.CanvasGroup

height()

Return the height of the canvas.

width()

Return the width of the canvas.

class Canvas()

A vanilla scroll view that sends all events to a given delegate

A view that sends all events to a given delegate.

All events a delegate could have that can be used:

  • draw()
  • becomeFirstResponder(event)
  • resignFirstResponder(event)
  • mouseDown(event)
  • mouseDragged(event)
  • mouseUp(event)
  • mouseMoved(event) (only when acceptsMouseMoved is set True)
  • rightMouseDown(event)
  • rightMouseDragged(event)
  • rightMouseUp(event)
  • mouseEntered(event)
  • mouseExited(event)
  • scrollWheel(event)
  • magnifyWithEvent(event)
  • rotateWithEvent(event)
  • swipeWithEvent(event)
  • keyDown(event)
  • keyUp(event)
  • flagChanged(event)
  • menu(event)
from mojo.canvas import Canvas
from mojo.drawingTools import *
from vanilla import Window

class ExampleWindow:

    def __init__(self):
        self.w = Window((400, 400), minSize=(200, 200))
        self.w.canvas = Canvas((0, 0, -0, -0), delegate=self)
        self.w.open()

    def draw(self):
        rect(10, 10, 100, 100)

ExampleWindow()
Inherits from subclass: mojo.canvas.Canvas
Last edited on 15/06/2018