Skip to main content

Простое рисование на холсте без бойлерплейта

Project description

A zero-boilerplate canvas drawing framework for Python 3, based on Pygame.

Some examples

Here’s some of the neat stuff you can do:

# import all
from drawzero import *

# simple shapes
fill('#12bbae')
line('red', (400, 400), (800, 800))
circle('yellow', (500, 560), 200)
filled_circle('brown', (500, 500), 20)
text('red', 'Hello, world!', (300, 200), 72)
rect('blue', (200, 600), 100, 100)
filled_rect('orange', (400, 600), 100, 100)
polygon('white', [(20, 200), (100, 240), (40, 160)])
filled_polygon('burlywood', 200, 400, 130, 304, 20, 342, 20, 458, 130, 496, )
https://raw.githubusercontent.com/ShashkovS/drawzero/master/doc/hello_world.png

Animation

Animations are also straightforward:

from drawzero import *
from math import sin, cos, pi

earth_orbit = 400
earth_radius = 30
earth_rot_step = 2 * pi / 360
moon_orbit = 100
moon_radius = 10
moon_rot_step = 2 * pi / 60

i = 0
while True:
    i += 1
    e_x = 500 + earth_orbit * cos(earth_rot_step * i)
    e_y = 500 + earth_orbit * sin(earth_rot_step * i)
    m_x = e_x + moon_orbit * cos(moon_rot_step * i)
    m_y = e_y + moon_orbit * sin(moon_rot_step * i)

    clear()
    filled_circle(c_red, (500, 500), 100)
    filled_circle(c_blue, (e_x, e_y), earth_radius)
    filled_circle(c_yellow, (m_x, m_y), moon_radius)
    tick()
https://raw.githubusercontent.com/ShashkovS/drawzero/master/doc/planet_animation.gif

Installation

In a Terminal window, type:

pip install drawzero

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

drawzero-0.1.11.tar.gz (147.0 kB view details)

Uploaded Source

Built Distribution

drawzero-0.1.11-py3-none-any.whl (9.8 kB view details)

Uploaded Python 3

File details

Details for the file drawzero-0.1.11.tar.gz.

File metadata

  • Download URL: drawzero-0.1.11.tar.gz
  • Upload date:
  • Size: 147.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.26.0 CPython/3.7.5

File hashes

Hashes for drawzero-0.1.11.tar.gz
Algorithm Hash digest
SHA256 372a372cee0c3a3e13cd8cc748ab10ee02884b6faf5b1809c8c144d41b9ac6a4
MD5 abe3e7af35296f750cf879ce737bc5cc
BLAKE2b-256 712f4e97eabb029ae60e1f83279011a92515412885fe9ac505e7cd6049601514

See more details on using hashes here.

File details

Details for the file drawzero-0.1.11-py3-none-any.whl.

File metadata

  • Download URL: drawzero-0.1.11-py3-none-any.whl
  • Upload date:
  • Size: 9.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.26.0 CPython/3.7.5

File hashes

Hashes for drawzero-0.1.11-py3-none-any.whl
Algorithm Hash digest
SHA256 8d338dc14187a943081adee37a63fdbde679c16e5502af8113d429e00ef45f1b
MD5 f64b6a99d2ca6d198a8f266826dc5beb
BLAKE2b-256 85afc0bf72dd4a04cf80d5edb6bcb064d9398b5d0b97d2adb09ecce617402c52

See more details on using hashes here.

Supported by

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