Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/publish-to-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: 3.11
python-version: "3.12"

- name: Install dependencies
run: |
Expand Down
5 changes: 4 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,12 @@ authors = [
]
description = "A UIKit for Pygame"
readme = "README.md"
requires-python = ">=3.7"
requires-python = ">=3.10"
classifiers = [
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
]
Expand Down
2 changes: 1 addition & 1 deletion src/PygameUIKit/barchart.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def color_from_float(colors):

class BarChart(EasyObject):
def __init__(self, values: list[int],
labels: list[str] = None,
labels: list[str] | None = None,
max_value=None,
ui_group=None,
font=pg.font.SysFont("Arial", 15),
Expand Down
3 changes: 2 additions & 1 deletion src/PygameUIKit/combobox.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
from collections.abc import Callable
from pygame import Color
import pygame as pg
from .label import DEFAULT_FONT, Label
Expand All @@ -23,7 +24,7 @@ def __init__(self, elements: list[str], ui_group=None, font=DEFAULT_FONT, font_c
self.hovered_index = self.selected_index
self.is_open = False
self._labels: list[Label] = []
self.actions: dict[int, callable] = {}
self.actions: dict[int, Callable] = {}

self.img_arrow_down = load_image(os.path.join(cwd, "assets", "combo_box_arrow.png"), (20, 20))
self.img_arrow_up = pg.transform.rotate(self.img_arrow_down.copy(), 180)
Expand Down
4 changes: 2 additions & 2 deletions src/PygameUIKit/text_input.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ def is_char(unicode):
class TextInput(EasyObject):
def __init__(self, *,
text="",
font: pg.font.Font = None,
fixed_width: int = None,
font: pg.font.Font | None = None,
fixed_width: int | None = None,
font_color=pg.Color('black'),
border_radius=0,
placeholder="",
Expand Down
4 changes: 1 addition & 3 deletions src/PygameUIKit/utilis.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from typing import Union

import pygame as pg
from pygame import Color

Expand Down Expand Up @@ -28,7 +26,7 @@ def draw_transparent_rect_with_border_radius(screen, color, rect, border_radius,
screen.blit(surf, rect)


def best_contrast_color(rgb_color: Union[Color, tuple]):
def best_contrast_color(rgb_color: Color | tuple):
if isinstance(rgb_color, Color):
rgb_color = rgb_color.r, rgb_color.g, rgb_color.b
r, g, b = rgb_color
Expand Down
6 changes: 3 additions & 3 deletions src/demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
import pygame
from pygame import Color

from src.PygameUIKit import Group
from src.PygameUIKit import text_input, button, slider, combobox
from src.PygameUIKit.barchart import BarChart
from PygameUIKit import Group
from PygameUIKit import text_input, button, slider, combobox
from PygameUIKit.barchart import BarChart

#
#
Expand Down