Skip to main content

Tools to help build Scratch extensions in Python.

Reason this release was yanked:

此版本的所有积木的opcode都被设为了"opcode"

Project description

Scratch Extension Tools

A Scratch Extension Tools. It can help you made Scratch Extension.

📦 Installation

pip install ScratchExtensionTools

📜 Changelog

See CHANGELOG.md

QuickStart

from ScratchExtensionTools import ScratchExtensionBuilder

builder = ScratchExtensionBuilder()

def hello_func():
    print("Hello Scratch!")

builder.create_block(
    opcode="say_hello",
    block_type="command",
    text="say hello",
    py_func=hello_func,
    show_in=['sprite']  # Python side argument, exported as `filter` in Scratch JSON
)

js_code = builder.build_extension(
    ext_id="demo",
    ext_name="Demo Extension",
    ext_color="#ffcc00"
)

print(js_code)  # => Scratch JS Extension

⚠️ Note on filter / showin

In Scratch extension JSON, the property is filter. But since filter is a Python built-in, this library uses the keyword showin on the Python side. It will still output filter correctly in the generated Scratch extension JSON.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

scratchextensiontools-1.2.1.tar.gz (5.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

scratchextensiontools-1.2.1-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

File details

Details for the file scratchextensiontools-1.2.1.tar.gz.

File metadata

  • Download URL: scratchextensiontools-1.2.1.tar.gz
  • Upload date:
  • Size: 5.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.12.9 Windows/11

File hashes

Hashes for scratchextensiontools-1.2.1.tar.gz
Algorithm Hash digest
SHA256 18f45472947f4d079612a279f55c2819d99b93c0314f86009ac4e4581b6b4ad6
MD5 1b40ddab41ce4a138b5c1acdcf674e53
BLAKE2b-256 f184e3a32e57392f5caef0e31e8f2a676c49b8af9abf1fbb6118078c165009f6

See more details on using hashes here.

File details

Details for the file scratchextensiontools-1.2.1-py3-none-any.whl.

File metadata

File hashes

Hashes for scratchextensiontools-1.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 72e95680d8ad9f1d9f6c7cfe7d553946d7314c627a13ec4bb2a95c4c504b269e
MD5 b33ad376b04af9bc82600a93166e0efe
BLAKE2b-256 d988ebf49960ebcafdac5af03f14dd4f2db0f97a0c5ac200a977e15021be137c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page