mojo.canvas
class CanvasGroup()
Deprecated. Use Merz to draw on screen.
A vanilla object that sends all events to a given delegate.
All events that a delegate could have can be used:
draw()
becomeFirstResponder(event)
resignFirstResponder(event)
mouseDown(event)
mouseDragged(event)
mouseUp(event)
mouseMoved(event)
(only whenacceptsMouseMoved
is set toTrue
)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)
shouldDrawBackground()
(returnFalse
for no background color)updateTrackingAreas()
(return a list of bounds rectangles[(x, y, w, h)), (x, y, w, h)]
)
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
class Canvas()
Deprecated. Use Merz to draw on screen.
A vanilla scroll view that sends all events to a given delegate
All events that a delegate could have can be used:
draw()
becomeFirstResponder(event)
resignFirstResponder(event)
mouseDown(event)
mouseDragged(event)
mouseUp(event)
mouseMoved(event)
(only whenacceptsMouseMoved
is setTrue
)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)
shouldDrawBackground()
(returnFalse
for no background color)updateTrackingAreas()
(return a list of bounds rectangles[(x, y, w, h)), (x, y, w, h)]
)
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