Skip to main content

Lightweight GUI widget toolkit for UPBGE (Uchronia Project Blender Game Engine).

Project description

pytest PyPI version

AlleyCat UI

A lightweight GUI widget toolkit for UPBGE (Uchronia Project Blender Game Engine) based on Cairo.

Screenshot

Introduction

AlleyCat UI is a lightweight GUI toolkit which means it doesn't rely on native peers, like Blender objects or any of its GUI related APIs.

It doesn't necessarily mean that it'd be faster in performance or lighter in memory consumption than those that do. However, being lightweight has its certain benefits too.

Because there is no native object to worry about, it is relatively easy to create a new type of components or extend the existing ones. Basically, you can make anything as long as you can draw it as an image, and the library exposes a Cairo context which provides many useful features to paint shapes.

Install

The library can be installed using pip as follows:

pip install alleycat-ui

You will need to have Cairo library in your library path in order for AlleyCat UI to work. Linux users can install it using a package manager while on Windows, you may get it from here (rename it to libcairo-2.dll and put it where Python looks for native libraries, like the value of PATH environment variable).

How to Use

To use UI components provided by AlleyCat UI, you need to create a proper context first. In most cases, you can use alleycat.ui.blender.UI to create a new context:

from alleycat.ui.blender import UI

context = UI().create_context()

Then you can use this context instance to create UI components, like labels and buttons like this:

from alleycat.ui import Label, LabelButton
from alleycat.ui.blender import UI

context = UI().create_context()

label = Label(context, text_size=18)
button = LabelButton(context, text="Button 1", text_size=16)

An important thing to remember is that only those components whose hierarchy is attached to an active Window can be rendered on screen. For example, if you create a Panel and add a Label to it, they won't be visible until you add the parent panel to an existing window.

If you want to create a window like popups or frames, you can use Frame which can be optionally configured to be draggable and resizable. On the other hand, if you just want to add components to the screen, you can use an Overlay instead, which is a transparent window that is automatically resized to fill the current screen:

from alleycat.ui import Bounds, Label, Overlay
from alleycat.ui.blender import UI

context = UI().create_context()

overlay = Overlay(context)

label = Label(context, text="My Label", text_size=18)
label.bounds = Bounds(10, 10, 180, 40)

overlay.add(label)

When you are done using the UI, you need to destroy the context by invoking its dispose() method. It is not strictly necessary if you are running the project with blenderplayer, but it may cause a crash if you run it inside Blender and stop the engine without properly disposing the context.

Status

The project is in a very early stage of development and only provides a minimal set of components and layout managers. Admittedly, the documentation is not sufficient to guide new users to get started with the library at the moment.

I will try to keep adding more components and enhancing the documentation. But for now, I'd encourage you to take a look at the test cases to get a better idea of how to use each APIs.

Please use it at your own risks. If you have any questions about the project, feel free to visit UPBGE Discord server and ask mysticfall#4102 for support.

License

This project is provided under the terms of GNU General Public License v3 (GPL3).

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

alleycat-ui-0.0.5.tar.gz (31.1 kB view details)

Uploaded Source

Built Distribution

alleycat_ui-0.0.5-py3-none-any.whl (56.1 kB view details)

Uploaded Python 3

File details

Details for the file alleycat-ui-0.0.5.tar.gz.

File metadata

  • Download URL: alleycat-ui-0.0.5.tar.gz
  • Upload date:
  • Size: 31.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.0 requests-toolbelt/0.9.1 tqdm/4.55.2 CPython/3.8.7

File hashes

Hashes for alleycat-ui-0.0.5.tar.gz
Algorithm Hash digest
SHA256 5d604bb3dbd74929581641fb8d13b637999994851f3ac60d5a64d58b86460b9d
MD5 6a1b3f4f5a1e68e53cda832b04f835d6
BLAKE2b-256 f7efa6d6c31040c71e02323ec3522c9211ffbee22904aa9cfcd4623a7649eed2

See more details on using hashes here.

File details

Details for the file alleycat_ui-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: alleycat_ui-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 56.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.0 requests-toolbelt/0.9.1 tqdm/4.55.2 CPython/3.8.7

File hashes

Hashes for alleycat_ui-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 547c2a7fe02f81752a169397e8ab616d495eb2674b1108d6761c6a13884d18e9
MD5 7413295b8cd69bae0a489034a1259e28
BLAKE2b-256 ba3e3d47ebc495a65deeba5dff3400467f1a930730cd926e15fcf3dd80f7d8f8

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