Skip to main content

A package for creating UI elements in pygame

Project description

pygame-ui-toolkit

pygame-ui-toolkit is a python library for easily creating UI elements with Pygame.

It makes it easy to add buttons, sliders, text inputs and more UI components to any pygame project.

Installation

Run the following command to install pygame-ui-toolkit via pip:

pip install pygame-ui-toolkit

Usage

Once installed, import the package into your project by entering the following line at the top of your script.

import pygame_ui_toolkit

There is no official documentation for this package.

The scripts in the examples directory should show you how to use the package. They detail the creation and use of all core UI elements and the presets.

Docstrings and type hints have been included within the scripts in the project, which should outline what each function and class does alongside the kinds of arguments that should be passed into them.

As a general tip, always remember to call an element's update() method once per frame. This is shown in the following example:

import pygame
import pygame_ui_toolkit

# Create the button
button = pygame_ui_toolkit.elements.button.RectButton(...)

# Main loop
while True:
    # Update the button
    button.update()

    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            quit()

Features

pygame-ui-toolkit offers the following features:

UI Elements:

These are the core user input elements that can be created using this library.

Buttons

  • Rectangle buttons
  • Bordered rectangle buttons
  • Circle buttons
  • Bordered circle buttons
  • Polygon buttons
  • Bordered polygon buttons
  • All of the above with text

Sliders

  • Horizontal sliders
  • Vertical sliders

Text Inputs

  • All buttons (other than polygon buttons) can be used as text inputs

Toggles

  • Tick box
  • Tick box with text to the left or right

Dropdown Menus

  • Rectangle dropdowns
  • Bordered rectangle dropdowns
  • Circle dropdowns
  • Bordered circle dropdowns

Text Boxes

  • All button types can be used as a text box

Presets:

These are additional functionalities added on top of the core UI elements.

Button

  • Changing colour when hovered over or clicked on
  • Changing size when hovered over or clicked on

Slider

  • Automatically updating text that displays the current slider value

Text Input

  • Automatically change size when hovered or clicked and change colour when currently selected

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-toolkit-1.0.0.tar.gz (20.4 kB view details)

Uploaded Source

Built Distribution

pygame_ui_toolkit-1.0.0-py3-none-any.whl (26.6 kB view details)

Uploaded Python 3

File details

Details for the file pygame-ui-toolkit-1.0.0.tar.gz.

File metadata

  • Download URL: pygame-ui-toolkit-1.0.0.tar.gz
  • Upload date:
  • Size: 20.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.1

File hashes

Hashes for pygame-ui-toolkit-1.0.0.tar.gz
Algorithm Hash digest
SHA256 28e6b51f4b6ee2c7ddaba0cc37dd0639131fd0cbf95e25cc6fb768ecc9aea47e
MD5 ad4032b2e6575a9f05ad8d5e1bcac4b5
BLAKE2b-256 c3f7113f00d3ed5ec87d6628ded5af5b4e81bec7a57282f99f08e2eba8649f87

See more details on using hashes here.

File details

Details for the file pygame_ui_toolkit-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for pygame_ui_toolkit-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0f2d1e0ba49910ad38ea4823664b7885b0e254b0c287636ba51e9f6e5e036d67
MD5 4d327b805323b801d6ec304aa1d0c18a
BLAKE2b-256 8148ea768a4b12e1c4c9da79670959f87ff659d856991f712e4892b5f5c0d2cd

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