Skip to main content

Brython.Dragdrop

A library for your Brython apps to implement drag-and-drop UX (User Experience), without needing to deal with low level drag or drop event callbacks.

Usage

Here comes some high level description.

  1. You create a board game's board using html tags, such as TABLE's TD.

  2. You create individual pieces by using normal html tags, and then you combine them with brython_dragdrop.DraggableMixin. For example:

    class Card(brython_dragdrop.DraggableMixin, html.SPAN):
        pass
    

    Then create as many cards as you like, and make them visible in your UI.

  3. You declare some area to be droppable, by defining rules. For example:

    brython_dragdrop.make_droppable(BOARD, rules={
        (Card, Card): brython_dragdrop.swap,
        (Card, html.TD): brython_dragdrop.occupy,
    })
    

    Predefined rules include:

    • swap which will swap two draggable pieces
    • join which will append dragged piece into the landing area, so that the landing area may contain more and more dragged pieces.
    • occupy which will swap the existing piece (if any) with dragged piece, or place dragged piece into the empty landing area. So that the landing area will contain up to one draggable piece.

Sample: todo.

Roadmap

  • More sophisticated API to support on-the-spot logic calculation before drop.

Metadata

Release files for brython-dragdrop 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for brython-dragdrop 0.1.0
File Size Uploaded
brython-dragdrop-0.1.0.tar.gz 4.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for brython-dragdrop 0.1.0
File Interpreter ABI Platform
brython_dragdrop-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 9.7 kB

Release files / brython-dragdrop-0.1.0.tar.gz

Download URL brython-dragdrop-0.1.0.tar.gz
Size 4.8 kB
Tags Source
SHA-256 checksum
How to use checksums
185c3210ccb2bc00ce1c1719e3c64feeb11765a43644bd9cf7dca13e612a354d
BLAKE2b-256 checksum
How to use checksums
36aa32dd63567562ea0dc30fb08a7ce49ec7dd5022e6d779c719ad0ddd445f9f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/4.0.2 CPython/3.11.7

Release files / brython_dragdrop-0.1.0-py3-none-any.whl

Download URL brython_dragdrop-0.1.0-py3-none-any.whl
Size 5.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
25a704b2b487f2f590f412ab741434a03f01e1321e01f763c1f139a4d903defb
BLAKE2b-256 checksum
How to use checksums
9358300224b65c1d11337cebe54c91e1400fda4927a0a264cd66ed47569a892a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/4.0.2 CPython/3.11.7

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page