Skip to main content

helpful tools/widgets for pygame

Project description

PygameHelper

source code
creator
PyGame
this is a package created to help you with pygame functionality
at this point it has the following classes:

| Class name |

|:----------:|

| Button |

| InputField |

| InputFieldNumbers |

| InputFieldLetters |

| Particle |

| Animation |

| SpriteSheet |

| Font |

also, PygameHelper offers some functions:

| Function name | description | cached | Numba jitted |

|:-------------:|:-----------:|:------:|:------------:|

| load_image | it loads an image from a given path and it performs .convert() | True | False |

| load_alpha_image | it loads an image from a given path and it performs .convert_alpha() | True | False |

| resize_smooth_image | wrapper for pygame.transform.smoothscale | False | False |

| resize_image | wrapper for pygame.transform.scale | False | False |

| resize_image_ratio | - | False | False |

| resizex | it resizes a image in both axis by the same amount | False | False |

| left_click | it checks for the left-click event | False | False |

| middle_click | it checks for the middle-click event | False | False |

| right_click | it checks for the right-click event | False | False |

| get_font | it returns a font | True | False |

| wrap_multi_lines | | True | False |

| blit_multiple_lines | it blits in a surface a list of strings | False | False |

| pixel_perfect_collision | it is a wrapper for pygame.mask.overlap and it handles the offset | False | False |

| flatten | it takes a iterable object and it flattens the object | False | False |

| get_cloth | it returns the cloth data from a file (basically a json reader) | False | False |

| get_neighbors | it returns the directly adjacent cells (it makes the assumption that it has rows of the same length) | False | False |

| get_neighbors_index | it returns the directly adjacent cells index (it makes the assumption that it has rows of the same length) | False | False |

| pathfinding | if finds the most efficient path from 1 point to another | False | False |

| combine_rects | it creates the smallest possible rect that contains all of the rects | False | False |

| save_frame | it saves the pixels from a pygame surface into a specified file, if unspecified it defaults to the pygame window | False | False |

| lerp | Calculates a number between two numbers at a specific increment | False | True |

| clamp | it clamps a value between mini and maxi | False | True |

| remap | it Re-maps a number from one range to another (nothing to do with regex it is just the name) | False | True |

| get_distance | it returns the distance between two points | False | True |

| get_distance_squared | it returns the distance squared between two points | False | True |

some drawing utils
they are wrapping pygame.draw but with some extra functionality

| Function name | description |

|:-------------:|:-----------:|

| draw.push | it saves the current draw location |

| draw.translate | it moves the current draw location |

| draw.pop | it goes to the previous draw location |

| draw.quadratic_bezier | Quadratic bezier curve (1 static, 1 control and 1 static point) |

| draw.bezier | it creates a bezier curve based on 4 points (1 static, 2 control points an 1 static) aka a cubic bezier |

| draw.beginShape | it begins tracing the vertices |

| draw.vertex | it adds a new vertex |

| draw.endShape | it stops tracing the vertices and draw the shape |

| draw.rect | a wrapper for pygame.draw.rect but it takes advantage of the position from translate |

| draw.polygon | a wrapper for pygame.draw.polygon but it takes advantage of the position from translate |

| draw.circle | a wrapper for pygame.draw.circle but it takes advantage of the position from translate |

| draw.ellipse | a wrapper for pygame.draw.ellipse but it takes advantage of the position from translate |

| draw.arc | a wrapper for pygame.draw.arc but it takes advantage of the position from translate |

| draw.line | a wrapper for pygame.draw.line but it takes advantage of the position from translate |

| draw.lines | a wrapper for pygame.draw.lines but it takes advantage of the position from translate |

| draw.aaline | a wrapper for pygame.draw.aaline but it takes advantage of the position from translate |

| draw.aalines | a wrapper for pygame.draw.aalines but it takes advantage of the position from translate |

Documentation

Documentation for the classes can be found in ./Documentation

Examples

Examples of the classes and functions can be found in ./Examples

contributions:


Pull requests are welcome!

Feel free to create a fork of this repository and use the code for any purpose. Credit is appreciated but not needed.

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

PygameHaze-0.3.6.tar.gz (31.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

PygameHaze-0.3.6-py3-none-any.whl (49.0 kB view details)

Uploaded Python 3

File details

Details for the file PygameHaze-0.3.6.tar.gz.

File metadata

  • Download URL: PygameHaze-0.3.6.tar.gz
  • Upload date:
  • Size: 31.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.6.1 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.5

File hashes

Hashes for PygameHaze-0.3.6.tar.gz
Algorithm Hash digest
SHA256 62a83fe0c97bc7eeebd314c1cb655d24711658e9737fb1e66dc55f9d9c683e89
MD5 b2c7dfff1f2eb3b3268890353394c0cd
BLAKE2b-256 348670d0498447693bca3bee82aee31ba0b02869aaf3ef2062a9e7252ac95837

See more details on using hashes here.

File details

Details for the file PygameHaze-0.3.6-py3-none-any.whl.

File metadata

  • Download URL: PygameHaze-0.3.6-py3-none-any.whl
  • Upload date:
  • Size: 49.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.6.1 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.5

File hashes

Hashes for PygameHaze-0.3.6-py3-none-any.whl
Algorithm Hash digest
SHA256 77c378368177b5be29b569e0ceb4818651fefc3f248278853366a8df4c12aff1
MD5 765676974c418610392abf63ff3b2db4
BLAKE2b-256 0a488891a69f3c3897d69700f1c6ae1f9da785110647d0d14351bed70fa67de4

See more details on using hashes here.

Supported by

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