A(nother) wrapper for the Python Discord Pixels API.
Project description
dpixels
A(nother) wrapper for the Python Discord Pixel API.
Features
- Proper ratelimite handeling.
- Saves ratelimits in a json file, so restarting scripts won't trigger cooldowns.
- Supports all Pixel API endpoints.
- Supports autodrawing of images.
Examples
Get the canvas:
client = dpixels.Client(token="your token")
canvas = await client.get_canvas()
# this also caches the canvas, so later you can do:
canvas = client.canvas
Get a specific pixel:
pixel = canvas[0, 0] # get the pixel at 0,0
pixel = await client.get_pixel(0, 0) # fetch the pixel at 0, 0
pixel.hex # the hex value
pixel.int # the int value
pixel.rgb # the rgb value
Setting a pixel:
await client.set_pixel(0, 0, dpixels.Color(255, 255, 255)) # set the pixel at 0,0 to white
Autodrawing an image:
from PIL import Image
im = Image.open("path_to_image.ext")
source = dpixels.Source.from_image((0, 0), im)
await client.draw_sources([source]) # draw the source
Credits
This library is heavily based on Artemis21/dpypx
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
dpixels-0.3.1.tar.gz
(6.9 kB
view details)
Built Distribution
File details
Details for the file dpixels-0.3.1.tar.gz
.
File metadata
- Download URL: dpixels-0.3.1.tar.gz
- Upload date:
- Size: 6.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.3.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9e5c52f55736a3ce4ae1e518f4933a8daa24c4f88ae2541cdac62b37fb5b2c00 |
|
MD5 | 63b95be44fb75adc3456e3d798355e4f |
|
BLAKE2b-256 | ec37a780f4768f94ddbedd9f51b2a6ce097bf34b8ae1ee4fea2dd93397ba7046 |
File details
Details for the file dpixels-0.3.1-py3-none-any.whl
.
File metadata
- Download URL: dpixels-0.3.1-py3-none-any.whl
- Upload date:
- Size: 8.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.3.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 31c78f44fb58afa47cffddc88d36b4b910410565ea2d848d70ac9168c5e2b22c |
|
MD5 | 60c665f2dfb09e52b803dd4e31e37ee7 |
|
BLAKE2b-256 | a215564f71e7b593acc0ceec05f8bad5a54226f574237b53cb4d594fc2f2c549 |