Skip to main content

DPYPX

A simple wrapper around Python Discord Pixels.

Requires Python 3.7+ (3.x where x >= 7).

Requires pillow and aiohttp from pip.

Example

import dpypx

# Create a client with your token.
client = dpypx.Client('my-auth-token')

# Download and save the canvas.
canvas = await client.get_canvas()
canvas.save('canvas.png')

# And access pixels from it.
print(canvas[4, 10])

# Or just fetch specific pixels.
print(await client.get_pixel(4, 10))

# Draw a pixel.
await client.put_pixel(50, 10, 'cyan')
await client.put_pixel(1, 5, dpypx.Colour.BLURPLE)
await client.put_pixel(100, 4, '93FF00')
await client.put_pixel(44, 0, 0xFF0000)

# Swap two pixels.
await client.swap_pixels((55, 1), (50, 3))

# Close the connection.
await client.close()

Auto-draw

Load an image:

from PIL import Image

im = Image.open('pretty.png')
ad = dpypx.AutoDrawer.load_image(client, (5, 40), im, scale=0.1)
await ad.draw()

To prefer fixing existing pixels to placing new ones:

await ad.draw_and_fix()

By default, this will also loop forever. To exit once the whole image is correct:

await ad.draw_and_fix(forever=False)

You can also manually specify each pixel:

ad = dpypx.AutoDrawer.load(client, '''0
0
3
2
ff0000
00ff00
0000ff
ff0000
00ff00
0000ff''')
await ad.draw()

Format of the drawing plan:

  • Leftmost X coordinate
  • Topmost Y coordinate
  • Width
  • Height
  • Each pixel, left-to-right, top-to-bottom.

Auto-draw will avoid colouring already correct pixels, for efficiency.

Logging

To see logs:

import logging

logging.basicConfig(level=logging.INFO)

Too see more logs:

logging.basicConfig(level=logging.DEBUG)

To see fewer logs:

logging.basicConfig(level=logging.WARNING)

Release files for dpypx 0.7.6

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

Source distribution (sdist)

Source distribution for dpypx 0.7.6
File Size Uploaded
dpypx-0.7.6.tar.gz 9.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for dpypx 0.7.6
File Interpreter ABI Platform
dpypx-0.7.6-py3-none-any.whl Python 3 none any Details

Total release size:20.0 kB

Release files / dpypx-0.7.6.tar.gz

Download URL dpypx-0.7.6.tar.gz
Size 9.5 kB
Tags Source
SHA-256 checksum
How to use checksums
53f19217cd2f066b28d47023541daef2f10a504ad13020fde180b46e20f86b5c
BLAKE2b-256 checksum
How to use checksums
c4e7ec64b2ca28b82d14418d0ea69272440ae0fd4fa4a9b97b22ed872f33421f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.9.5

Release files / dpypx-0.7.6-py3-none-any.whl

Download URL dpypx-0.7.6-py3-none-any.whl
Size 10.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fe030ab89b0fbb8c725f318cf2fb6734adaf416d34c27ef0464131e447440327
BLAKE2b-256 checksum
How to use checksums
064f9003846c242586d2bb01ed37e42dd4b7ef71c9bec26b250cc9147d4d54ac
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.9.5

Release history Release notifications | RSS feed

This release

0.7.6 This release

2 release files

0.7.5

2 release files

0.7.4

2 release files

0.7.3

2 release files

0.7.2

2 release files

0.7.1

2 release files

0.7.0

2 release files

0.6.3

2 release files

0.6.2

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.3

2 release files

0.5.2

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.0

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