Skip to main content

PyRect is a simple module with a Rect class for Pygame-like rectangular areas.

Project description

PyRect is a simple module with a Rect class for Pygame-like rectangular areas.

This module is like a stand-alone version of Pygame’s Rect class. It is similar to the Rect module by Simon Wittber, but compatible with both Python 2 and 3.

Currently under development, though the basic features work.

Examples

>>> import pyrect
>>> rectangle = pyrect.Rect(0, 0, 20, 10)
>>> rectangle.topleft
(0, 0)
>>> rectangle.bottomright
(20, 10)
>>> rectangle.width
20
>>> rectangle.height
10
>>> rectangle.width = 100 # updating one attribute automatically updates all the others
>>> rectangle.bottomright
(100, 10)
>>> rectangle.left = 50
>>> rectangle.topleft
(50, 0)
>>> rectangle.bottomright
(150, 10)
>>> rectangle.box # the box tuple shows (left, top, width, height)
(50, 0, 100, 10)
>>> floatRectangle = pyrect.Rect(0, 0.2, 20.4, 10.6, enableFloat=True) # allow float values
>>> floatRectangle.box
(0.0, 0.2, 20.4, 10.6)
>>> intRectangle = pyrect.Rect(0, 0.2, 20.4, 10.6) # integers-only by default
>>> intRectangle.box
(0, 0, 20, 10)

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

PyRect-0.0.2.tar.gz (13.2 kB view details)

Uploaded Source

File details

Details for the file PyRect-0.0.2.tar.gz.

File metadata

  • Download URL: PyRect-0.0.2.tar.gz
  • Upload date:
  • Size: 13.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.7.0

File hashes

Hashes for PyRect-0.0.2.tar.gz
Algorithm Hash digest
SHA256 a1500257d9791c7fc336ba470bd66c93d6bf20f059f497bfc9e1c9cf2fb88da5
MD5 0beb73fb976469746dd5cb0e71280a44
BLAKE2b-256 8d731d0f7cb0819ee0bf6b2fde784b8878cc08e810752163d552e352d27a8fa2

See more details on using hashes here.

Provenance

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