Pydraw

Latest version: v2.1.5

Safety actively analyzes 688578 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

2.1

Hey all! It's been a while since a major release and we've added enough features to where I think it's time to step it up a major release! This version of pyDraw includes lots of new and exciting features, and even more critically, plenty of bug fixes.

Exciting additions include the new `Sound` class, `RoundedRectangle`, fixed `lookAt` and resolved border issues.

You can use the the new `Sound` class like so:
py
... inside pydraw project
sound = Sound('path/to/sound.wav', autoplay=False)
self.play() plays the sound!


You can use the new `RoundedRectangle` class like so:
py
... inside pydraw project
rounded_rect = RoundedRectangle(screen, 10, 10, 100, 100, Color('black'), radius=10) radius is the border radius of the shape


Changelog (some already pushed in minor updates):
- Fixes for `.overlaps()`, optimizations for `.overlaps()`
- Fixed issue with text centering and `border_width` defaulting to 1 when `.border()` is called.
- Revamped how input is handled, added more input keys (~, `)
- New Sound class to play basic sounds (no pausing or scrubbing yet!)
- Fixed `lookAt` method for all Renderables
- Overloaded center methods
- `bounds()` method to get bounded box around any Renderable
- Corrected text height/width calculations for new lines
- Fixed bug with `Line.dashes()` type verification
- Added `update()` optimization to only rotate vertices if a rotation state modification has occurred.
- Added `RoundedRectangle` class, which replaces the border system with a rounding-corner system
- Various small border and rotation fixes
- Fixed some issues with `Scene` class and updated to match new input order with `Screen`
- Added overloaded constructors with Border Color to all shapes (not images) [no longer requires keys to use]

2.0

Hey everyone!

Just writing up this quick release for some somewhat breaking input changes that have been made. There are of course some bugs that have been fixed, and the documentation is in the process of being updated to reflect new changes.

Changelog:
- Fixed border bugs with rounded corners
- Fixed fill bug for Polygons
- Fixed text bugs
- Added `.bounds()` method (retrieves a rectangular hitbox that fits the shape respective to position and angle)
- Added `RoundedRectangle` class (instead of borders, has a radius)
- Modified input argument order ⭐

That last one is pretty important. Let me show you.
Previously mouse input has always been handled with these arguments:
py
def mouesdown(button, location)


But now it has been switched around to:
py
def mousedown(location, button)


Don't worry, the old way of doing things still works, but it is deprecated and pyDraw will yell at you if you don't make the proper changes! If you're wondering why this change was made, it was made for one to match some of the other design decisions in pyDraw and javaDraw and put the most crucial argument first. But it was also made to support a new shorthand input format which looks like this:

py
def mousedown(location)


So now you don't need to take in the button if you don't want to!

(Please note that the old way of input is supported via name detection, so if your arguments are not named in the recommended way your variables will be passed in the new order.

Hope everyone is having a happy schoolyear, and I look forward to further updates!

Cheers,
Noah

1.4.1

Hello everyone!

It's been a while but I am here and back at it with another release. This one, albeit smaller, contains a lot of bugfixes and quality of life improvements to make pyDraw even easier and more consistent.

Some of the new Features include:
- 15+ fixed bugs 🚀
- Newer and more efficient image rendering 💡
- Renderable.center(new_center) 🎯
- Added Line.intersects(Renderable) 💻
- Added "Scenes" (more on this below) 🎥
- And so much more...

There's been a lot more but I wanted to go ahead and publish this release so everyone can see this!

Scenes
Now you can manage multi-stage applications with more ease than ever with the Scene class!

Just extend the Scene class like so and create a new instance of it to be passed to the Screen class, like so:

python
from pydraw import *

class MyScene(Scene):
def init(self, screen):
Put our initalizer code here!

def run(self, screen):
Loop code should go in here, as it is run after the "init" method!

We can also define input methods in here to allow for the same functionality as a default pydraw Screen!


Now we create a screen
screen = Screen(800, 600)
screen.scene(MyScene())


There will be a future post going into more depth on Scenes, but for now, check out the [documentation](https://docs.pydraw.graphics)!



With more to come,
Noah

1.2.3

Hello fellow nerds! 🤓

I am so excited to announce this new version of pyDraw. So much has happened since the last release. We've completely rebased our code and finalized a lot of systems! 💻

Some Changes/Features:
- Huge optimization and complete refactoring of code! 🚀
- Text is now rotatable, and is a Renderable! `.contains()` and `.overlaps()` now work! 💬
- Rotation, Resizing, and more with CustomPolygons! 🔸
- Images, supporting most data types! 😺
- Animated GIFs and other supporting image-types! 📷
- Regular Polygons and other Renderables will always fit the width/height constraints provided (this means stretching!) 🧱

There's just too much to cover, if you'd like a more in depth look, you should just check the comments since v1.0.0 🤣 (I can't keep track).

Also, we've updated our documentation and website, which is accessible at: https://pydraw.graphics

Enjoy!
- Noah

1.0.0

Hey, ya'll!

(INSTALLATION INSTRUCTIONS)
`pip install pydraw`

Noah here! This is the official first release of pydraw, and I am super excited! We added so much in the past few weeks that it makes me ecstatic with joy to finally be pushing something out!

Here is a full list of pyDraws main features:
- Screen class to manage a screen with OOP `.remove()`, `.update()`, and `.sleep()`
- Color class to standardize colors in graphics (no more strings, tuples, and all that nonsense)
- Full array of objects: (Rectangle, Oval, Triangle, Polygon, CustomPolygon, Image, Line, Text)!
- Get or set values with the same function! Simplified and paralleled interfaces! All Renderables have the same methods!
- Rotate or modify images as long as PIL or Pillow is installed on the machine (if you do `pip install pydraw`, this is automatic!)
- Modify an images color with an overlay using the custom `.color()` method
- Have lines point at locations using the `.lookat()` method
- Move objects using `.move()`, `.moveto()`, or modify individual coordinates via `.x()` and `.y()`
- FANTASTIC Input System, simplified and automated to make it as easy as writing a few methods.
- `.clone()` and `.transform()` methods which create an easy way to duplicate objects or copy their (width, height, angle)!
- and just SO MUCH MORE!

This has been so fun to create and I look forward to many more commits pushed, docs updated, and sweats broken :)

Enjoy pyDraw!

Links

Releases

Has known vulnerabilities

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.