Skip to main content

A package for fluid uis in PyGame

Project description

pygame-ui

Introduction & Overview

Here's my attempt at creating a fluid User Interface library built for pygame 2+

This project is current VERY EARLY in development, so there are probably loads of bugs that you'll experience when messing about with it, so feel free to open an issue or create a PR and fix the bug yourself :)

How to use

Just take a look in the repo and try out some of the example files - I suggest you look into how they work to get an idea of how you'd setup your own uis :)

Warning: Some examples/*.py files may no longer be functional, as I've done quite a large rewrite of the main Widget & Container code. I'll try and get all the tests setup properly asap.

Good Practice: examples/complex.py is the most recent of the examples/*.py files, and it is therefor written the most efficiently and pythonic. I recommend you take a look through it so you can plan out how to setup your own interfaces.

Here's what you should see when you run examples/complex.py, you can use the WASD keys to resize the Window Widget

a gif of examples/complex.py in action

Further Code Examples

A window with two stretching widgets, organised in a row

import PygameUi
Window = PygameUi.Window
Widget = PygameUi.Widget
Layout = PygameUi.Layout
Tags = pygameUi.widget_tags.Tags

# initialise a main window,
# and set its size to 300x200

main_window = Window()
main_window.size = (300,200)
main_window.layout_direction = Tags.ROW

# create two child widgets,
# and set their fluid sizes to
# have the same priority - so
# they take up the same amount
# of space

child_left = Widget()
child_left.fluid_size = (1,1)
child_right = Widget()
child_right.fluid_size = (1,1)

main_window.add_children([child_left, child_right])

# this is NOT all the code required-
# you also need your basic pygame loop
# and event management. If you're not
# sure how that would be setup, I
# recommend you look into some of the
# example files to get a rough idea

License

Please make sure to read the LICENSE file before deciding to release your own versions of my code, also feel free to add a PR to change anything or fix anything up

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

pygame-ui-mb-0.1.1.tar.gz (24.9 kB view details)

Uploaded Source

Built Distribution

pygame_ui_mb-0.1.1-py3-none-any.whl (26.5 kB view details)

Uploaded Python 3

File details

Details for the file pygame-ui-mb-0.1.1.tar.gz.

File metadata

  • Download URL: pygame-ui-mb-0.1.1.tar.gz
  • Upload date:
  • Size: 24.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.1 pkginfo/1.7.0 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.6

File hashes

Hashes for pygame-ui-mb-0.1.1.tar.gz
Algorithm Hash digest
SHA256 fa1df631cd5c11219d8886f24c99f6912ce7f2c15aa3c9653d8bf8c1dd394d24
MD5 510bf4bc46d32cfeae74214c58b375f5
BLAKE2b-256 9e30a7a56b0c4ce19453bc062e110503a346accf3f5f513811815203b0dcb84b

See more details on using hashes here.

File details

Details for the file pygame_ui_mb-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: pygame_ui_mb-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 26.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.1 pkginfo/1.7.0 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.6

File hashes

Hashes for pygame_ui_mb-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 fd089c2d0f738bd4e490e379fef6a24a1eb18fc60f8afa61d3b6a80dda45e0e5
MD5 ddcae320d414eca031d23c0691f4369e
BLAKE2b-256 5a6d9f8df6a8b0b5efa7ff4298fd01b00bb02f66f6d0c3a33ed66f55de182fa0

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