Skip to main content

Client library for Sidekick Visual Coding Buddy

Project description

Sidekick Python Library (sidekick-py)

PyPI version

This library provides the Python interface for interacting with the Sidekick Visual Coding Buddy frontend UI, typically running within VS Code. It allows your Python scripts to easily create, update, and interact with visual modules like grids (Grid), consoles (Console), variable visualizers (Viz), drawing canvases (Canvas), and UI controls (Control).

Installation

Install the library using pip:

pip install sidekick-py

You will also need the Sidekick VS Code extension installed and running in VS Code.

Minimal Usage Example

First, open the Sidekick panel in VS Code (Press Ctrl+Shift+P, search for and run Show Sidekick Panel).

Then, save and run the following Python script:

import sidekick

# 1. Create a default 16x16 Grid
grid = sidekick.Grid()

# 2. Define what happens when a cell is clicked
def handle_click(x, y):
    # Update the clicked cell in the Sidekick UI
    grid.set_color(x, y, 'red')
    print(f"Cell ({x}, {y}) clicked!") # Optional: Print to terminal

# 3. Register the click handler
grid.on_click(handle_click)

# 4. Keep the script running to listen for clicks!
#    Without this, the script would end, and clicks wouldn't be handled.
sidekick.run_forever()

After running the script, clicking the grid cells in the Sidekick panel will turn them red. Press Ctrl+C in the terminal to stop.

Learn More

This library simplifies the process by handling WebSocket communication and message formatting, allowing you to focus on controlling the visual elements from your Python code.

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

sidekick_py-0.0.4.tar.gz (55.9 kB view details)

Uploaded Source

File details

Details for the file sidekick_py-0.0.4.tar.gz.

File metadata

  • Download URL: sidekick_py-0.0.4.tar.gz
  • Upload date:
  • Size: 55.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.7

File hashes

Hashes for sidekick_py-0.0.4.tar.gz
Algorithm Hash digest
SHA256 f2e0e0e6b2dca7bac37d1486a4b13506e7ebb1a3c15cd819c4a6467d43a2094b
MD5 fe193917bdff4d114203d9877c56d08e
BLAKE2b-256 8ef7f420d9656411db9e9173efa94f8f9140258c8622ed946833f7d2a0fd04a5

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