Thumby API Documentation
To get started using the Thumby API, import the module at the top of your MicroPython program:
Constants
__version__
- type: string
- values: 1.0 ~ limitless (increased for changes to library)
Use these screen dimension constants in place of the actual pixel dimensions of the screen to remove magic numbers from your code:
thumby.display.width
| number of pixels that define the screen width
- type: int
- value: 72
thumby.display.height
| number of pixels that define the screen height
- type: int
- value: 40
Methods
Documentation Page | Functions |
---|---|
Display basics | thumby.display.update() thumby.display.setFPS(FPS) thumby.display.fill(color) thumby.display.brightness(brightness) |
Text & Font | thumby.display.drawText(string, x, y, color) thumby.display.setFont(fontFilePath, width, height, space) |
Get & Set Pixels | thumby.display.setPixel(x, y, color) thumby.display.getPixel(x, y) |
Draw Lines | thumby.display.drawLine(x1, y1, x2, y2, color) |
Draw Rectangles | thumby.display.drawFilledRectangle(x, y, w, h, color) thumby.display.drawRectangle(x, y, w, h, color) |
Draw Sprites | thumby.Sprite(width, height, bitmapData, x, y, key, mirrorX, mirrorY) Sprite.getFrame() Sprite.setFrame(frame) |
Button Input | thumby.buttonX.pressed() thumby.buttonX.justPressed() |
Audio | thumby.audio.play(freq, duration, duty) thumby.audio.playBlocking(freq, duration, duty) thumby.audio.stop() thumby.audio.set_enabled(setting) |
Multiplayer Link | thumby.link.send(data) thumby.link.receive() |
Draw Using Blit | thumby.display.blit(bitmapData, x, y, width, height, key, mirrorX, mirrorY) thumby.display.blitWithMask(bitmapData, x, y, width, height, key, mirrorX, mirrorY, maskBitmapData) thumby.display.drawSprite(sprite) thumby.display.drawSpriteWithMask(sprite, maskSprite) |