Skip to main content

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).

Release files for alleycat-ui 0.0.5

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

Source distribution (sdist)

Source distribution for alleycat-ui 0.0.5
File Size Uploaded
alleycat-ui-0.0.5.tar.gz 31.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for alleycat-ui 0.0.5
File Interpreter ABI Platform
alleycat_ui-0.0.5-py3-none-any.whl Python 3 none any Details

Total release size:87.3 kB

Release files / alleycat-ui-0.0.5.tar.gz

Download URL alleycat-ui-0.0.5.tar.gz
Size 31.1 kB
Tags Source
SHA-256 checksum
How to use checksums
5d604bb3dbd74929581641fb8d13b637999994851f3ac60d5a64d58b86460b9d
BLAKE2b-256 checksum
How to use checksums
f7efa6d6c31040c71e02323ec3522c9211ffbee22904aa9cfcd4623a7649eed2
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / alleycat_ui-0.0.5-py3-none-any.whl

Download URL alleycat_ui-0.0.5-py3-none-any.whl
Size 56.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
547c2a7fe02f81752a169397e8ab616d495eb2674b1108d6761c6a13884d18e9
BLAKE2b-256 checksum
How to use checksums
ba3e3d47ebc495a65deeba5dff3400467f1a930730cd926e15fcf3dd80f7d8f8
Upload date
Uploaded using Trusted Publishing?
What is 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

Release history Release notifications | RSS feed

This release

0.0.5 This release

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

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