Skip to main content

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

Metadata

Release files for pygame-ui-mb 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pygame-ui-mb 0.1.1
File Size Uploaded
pygame-ui-mb-0.1.1.tar.gz 24.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pygame-ui-mb 0.1.1
File Interpreter ABI Platform
pygame_ui_mb-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 51.4 kB

Release files / pygame-ui-mb-0.1.1.tar.gz

Download URL pygame-ui-mb-0.1.1.tar.gz
Size 24.9 kB
Tags Source
SHA-256 checksum
How to use checksums
fa1df631cd5c11219d8886f24c99f6912ce7f2c15aa3c9653d8bf8c1dd394d24
BLAKE2b-256 checksum
How to use checksums
9e30a7a56b0c4ce19453bc062e110503a346accf3f5f513811815203b0dcb84b
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / pygame_ui_mb-0.1.1-py3-none-any.whl

Download URL pygame_ui_mb-0.1.1-py3-none-any.whl
Size 26.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fd089c2d0f738bd4e490e379fef6a24a1eb18fc60f8afa61d3b6a80dda45e0e5
BLAKE2b-256 checksum
How to use checksums
5a6d9f8df6a8b0b5efa7ff4298fd01b00bb02f66f6d0c3a33ed66f55de182fa0
Upload date
Uploaded using Trusted Publishing?
What is 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

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

0.0.6

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page