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 download the repo, extract it, and run the test files! - Feel free to look into how they work
Warning: Some test_*.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: test_complex.py
is the most recent of the test_*.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 test_complex.py
, you can use the WASD keys to resize the Window Widget
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 a widget for the left
# and right side, and set them
# both to be fluid, and 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)
# experiment with changing child_left's
# first value in for its fluid_size
# and see how that affects it!
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
# test files to get a rough idea
Extra Notes
This code is awful, I'm aware.. haha
License
Please make sure to read the COPYING/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
Built Distribution
File details
Details for the file pygame-ui-mb-0.0.3.tar.gz
.
File metadata
- Download URL: pygame-ui-mb-0.0.3.tar.gz
- Upload date:
- Size: 23.4 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
Algorithm | Hash digest | |
---|---|---|
SHA256 | fc7abe1e9d83e6540c55f4a886f4e6e80301441df819c12cd549908031c1745c |
|
MD5 | 8996a20c274bacb115542d714588a8ce |
|
BLAKE2b-256 | e894636c0331d1edc78ce1ffea3746af76a811f4d1bb973b4f1a14216d9d385d |
File details
Details for the file pygame_ui_mb-0.0.3-py3-none-any.whl
.
File metadata
- Download URL: pygame_ui_mb-0.0.3-py3-none-any.whl
- Upload date:
- Size: 24.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
Algorithm | Hash digest | |
---|---|---|
SHA256 | c69aeace1764d7011cad9f512113017093638b301795e8ffe0d5d997d9ffe70b |
|
MD5 | cbc5573592ddcbdbb71545cc4eaedcd8 |
|
BLAKE2b-256 | 63b409ccab5f9f0d5e11f38946a21269ec28baa87e5c1491b885ce90b5991c4f |