Skip to main content

The package is an add-on for Pygame to create a user interface on the screen.

Project description

pgpyui 0.1.2

pgpyui is an add-on module for pygame to create a user interface.

Installation

pip install pgpyui

Usage

Button

Imports

from pgpyui import button
import pygame

Creating a button

button = button.Button((100, 100), (200, 100), "Some text", func, sprites=["sprites/sprite1.png", "sprites/sprite2.png"])

Event handling

button.check_events(event)

Drawing

button.draw(window)

Text Area

Imports

from pgpyui import textarea
import pygame

Creating a text area

textarea = textarea.TextArea((200, 100), (100, 100), 20, 15, is_enter=False, font="Arial")

Event handling

textarea.check_events(event)

Drawing

textarea.draw(window)

Information output

text: list[str] = textarea.data_return()

Slider

Imports

from pgpyui import slider
import pygame

Creating a slider

slider = slider.Slider((200, 100), (100, 100), 100, orientation="True")

Event handling

slider.check_events(event)

Drawing

slider.draw(window)

Information output

prgrs: int = slider.data_return()

CheckBox

Imports

from pgpyui import checkbox
import pygame

Creating a checkbox

chkbox = checkbox.CheckBox((100, 100), (50, 50), 3, 75, color=(0, 0, 0), ["passive.png", "active.png"])

Event handling

chkbox.check_events(event)

Drawing

chkbox.draw(window)

Information output

prgrs: list = chkbox.data_return()

Radio-button

Imports

from pgpyui import radio
import pygame

Creating a radio-button

radiob = radio.Radio((100, 100), 25, 10, 100)

Event handling

radiob.check_events(event)

Drawing

radiob.draw(window)

Information output

rt: list = radiob.data_return()

Documentation

Button

Parameters:

  • position: The position of the button.
  • size: The size of the button.
  • text: The text on the button.
  • function: The function to be called when the button is clicked.
  • sprite: A sprite to use for the button (optional).

TextArea

Parameters:

  • position: The position of the text area.
  • size: The size of the text area.
  • font_size: The size of the font.
  • max_symbols: The maximum number of symbols that can be entered.
  • is_enter: Whether or not the enter key should be allowed.
  • font: The name of the font to use (optional).

Slider

Parameters:

  • position: The position of the slider.
  • size_block: The size of the block slider.
  • len: Length of slide.
  • max_symbols: The maximum number of symbols that can be entered.
  • orientation: Horisontal or vertical slider. (optional)

CheckBox

Parameters:

  • position: The position of the CheckBox.
  • size: The size of the block Checkbox.
  • num_boxes: The num of CheckBoxes.
  • step: The distance between the boxes.
  • color: Color of the box. (optional)
  • sprites: Two sprites - the first without a check mark, the second with a check mark. (optional)

Radio-button

Parameters:

  • position: The position of the radio-button.
  • radius: Radius of radio-button.
  • num_rb: The num of radio-buttons.
  • step: The distance between the buttons.
  • color: Color of the box. (optional)

License

MIT

Author mail

mixail.vilyukov@icloud.com

Documentation site

https://memdved.github.io/pgpyui-doc/index.html

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

pgpyui-0.1.2.tar.gz (6.7 kB view details)

Uploaded Source

File details

Details for the file pgpyui-0.1.2.tar.gz.

File metadata

  • Download URL: pgpyui-0.1.2.tar.gz
  • Upload date:
  • Size: 6.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.2

File hashes

Hashes for pgpyui-0.1.2.tar.gz
Algorithm Hash digest
SHA256 ac4e28cb09b7a21669b4c9dc623d1620211fddccec4fb2919f0dc8aa93bbf6dc
MD5 6e8f0967075bd94d0db153a5942a2841
BLAKE2b-256 6e25b7aed737f1e69b48dd7b1aa9d299dedf0f3b08a968805d272d5741abde38

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