Skip to content
/ guipy Public

UI components library for pygame. Making prototyping, simulation, and graphing easier in research and corporate settings.

License

Notifications You must be signed in to change notification settings

Zjjc123/guipy

Repository files navigation

Guipy

Python Version License

Pygame UI Library built by Casey (@caseyhackerman) and Jason

Installation

pip install guipylib

or with poetry

poetry add guipylib

Components

Button

Button

Dropdown

Dropdown

Live Plot

Live Plot

Plot

Plot

Slider

Slider

Switch

Switch

Textbox

Textbox

Example

import pygame

import colorsys

from guipy.components.slider import Slider
from guipy.manager import GUIManager
from guipy.utils import *

winW = 1280
winH = 720

root = pygame.display.set_mode((winW, winH))

man = GUIManager()

mySlider = Slider(height=50, width=500, thickness=5, radius=12, initial_val=0.4)
mySlider2 = Slider(height=50, width=500, thickness=5, radius=12, initial_val=0)
mySlider3 = Slider(height=50, width=500, thickness=5, radius=12, initial_val=0.5)
mySlider4 = Slider(height=50, width=500, thickness=5, radius=12, initial_val=0.5)

man.add(mySlider, (0, 25))
man.add(mySlider2, (0, 75))
man.add(mySlider3, (0, 125))
man.add(mySlider4, (0, 175))

running = True
while running:
    events = pygame.event.get()
    for event in events:
        if event.type == pygame.QUIT:
            running = False

    root.fill(DARK_GREY)

    color = tuple(
        i * 255
        for i in colorsys.hls_to_rgb(mySlider2.val, mySlider3.val, mySlider4.val)
    )
    center = (winW // 2, winH // 2)
    r = 10 + mySlider.val * 100
    pygame.draw.circle(root, color, center, r)
    pygame.draw.circle(root, BLACK, center, r, 3)

    man.update(pygame.mouse.get_pos(), events, root)
    pygame.display.update()

Documentation

Check out some helpful guides and API references here

About

UI components library for pygame. Making prototyping, simulation, and graphing easier in research and corporate settings.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages