pyforgeui 1.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pyforgeui/Behavior/Element_behavior.py +42 -0
- pyforgeui/Behavior/Mouse_collision.py +108 -0
- pyforgeui/Behavior/Pressed_button.py +86 -0
- pyforgeui/Behavior/__init__.py +3 -0
- pyforgeui/Containers/Layout.py +156 -0
- pyforgeui/Containers/Modal.py +102 -0
- pyforgeui/Containers/Panel.py +123 -0
- pyforgeui/Containers/Tab_container.py +116 -0
- pyforgeui/Containers/__init__.py +4 -0
- pyforgeui/Elements/Check_box.py +101 -0
- pyforgeui/Elements/Combo_box.py +386 -0
- pyforgeui/Elements/Image_element.py +79 -0
- pyforgeui/Elements/Input_text.py +42 -0
- pyforgeui/Elements/Keybind_button.py +81 -0
- pyforgeui/Elements/Number_spinner.py +105 -0
- pyforgeui/Elements/Polygon_button.py +18 -0
- pyforgeui/Elements/Progress_bar.py +95 -0
- pyforgeui/Elements/Radio_button.py +128 -0
- pyforgeui/Elements/Scroll_bar.py +208 -0
- pyforgeui/Elements/Slider.py +146 -0
- pyforgeui/Elements/Text.py +25 -0
- pyforgeui/Elements/Text_button.py +13 -0
- pyforgeui/Elements/Toggle_switch.py +114 -0
- pyforgeui/Elements/Tooltip.py +83 -0
- pyforgeui/Elements/__init__.py +15 -0
- pyforgeui/Elements_Factory.py +120 -0
- pyforgeui/UI_Manager.py +104 -0
- pyforgeui/__init__.py +81 -0
- pyforgeui-1.0.0.dist-info/METADATA +150 -0
- pyforgeui-1.0.0.dist-info/RECORD +34 -0
- pyforgeui-1.0.0.dist-info/WHEEL +5 -0
- pyforgeui-1.0.0.dist-info/licenses/LICENSE +21 -0
- pyforgeui-1.0.0.dist-info/licenses/LICENSE.md +621 -0
- pyforgeui-1.0.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import pygame
|
|
2
|
+
try:
|
|
3
|
+
from .Elements import *
|
|
4
|
+
from .Containers import *
|
|
5
|
+
from .UI_Manager import UIManager
|
|
6
|
+
except ImportError:
|
|
7
|
+
from Elements import *
|
|
8
|
+
from Containers import *
|
|
9
|
+
from UI_Manager import UIManager
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class ElementsFactory:
|
|
13
|
+
"""Centralized factory for creating themed PyForgeUI widgets and containers."""
|
|
14
|
+
|
|
15
|
+
def __init__(self, config: dict) -> None:
|
|
16
|
+
self.screen = config["screen"]
|
|
17
|
+
self.window = config.get("window", None)
|
|
18
|
+
self.font = config.get("font", pygame.font.Font(None, 25))
|
|
19
|
+
self.color = config.get("color", (255, 255, 255))
|
|
20
|
+
self.hover_color = config.get("hover_color", (255, 199, 51))
|
|
21
|
+
self.color_back = config.get("color_back", (255, 255, 255))
|
|
22
|
+
self.sound_hover = config.get("sound_hover", None)
|
|
23
|
+
self.sound_touch = config.get("sound_touch", None)
|
|
24
|
+
|
|
25
|
+
def _base_config(self, config: dict, include_font: bool = True, include_sounds: bool = True) -> dict:
|
|
26
|
+
base = {
|
|
27
|
+
"screen": self.screen,
|
|
28
|
+
"window": self.window,
|
|
29
|
+
"color": self.color,
|
|
30
|
+
"hover_color": self.hover_color,
|
|
31
|
+
}
|
|
32
|
+
if include_font:
|
|
33
|
+
base["font"] = self.font
|
|
34
|
+
if include_sounds:
|
|
35
|
+
base["sound_hover"] = self.sound_hover
|
|
36
|
+
base["sound_touch"] = self.sound_touch
|
|
37
|
+
base.update(config)
|
|
38
|
+
return base
|
|
39
|
+
|
|
40
|
+
def create_Text(self, config: dict) -> Text:
|
|
41
|
+
return Text(self._base_config(config, include_font=True, include_sounds=False))
|
|
42
|
+
|
|
43
|
+
def create_TextButton(self, config: dict) -> TextButton:
|
|
44
|
+
return TextButton(self._base_config(config))
|
|
45
|
+
|
|
46
|
+
def create_PolygonButton(self, config: dict) -> PolygonButton:
|
|
47
|
+
return PolygonButton(self._base_config(config, include_font=False))
|
|
48
|
+
|
|
49
|
+
def create_InputText(self, config: dict) -> InputText:
|
|
50
|
+
cfg = {"color_back": self.color_back, **config}
|
|
51
|
+
return InputText(self._base_config(cfg))
|
|
52
|
+
|
|
53
|
+
def create_ScrollBar(self, config: dict) -> ScrollBar:
|
|
54
|
+
return ScrollBar(self._base_config(config, include_font=False))
|
|
55
|
+
|
|
56
|
+
def create_ComboBox(self, config: dict) -> ComboBox:
|
|
57
|
+
type_key = (config.get("type_dropdown", "down")).lower()
|
|
58
|
+
mapping = {
|
|
59
|
+
"down": ComboBoxDown,
|
|
60
|
+
"up": ComboBoxUp,
|
|
61
|
+
"right": ComboBoxRight,
|
|
62
|
+
"left": ComboBoxLeft,
|
|
63
|
+
}
|
|
64
|
+
cls = mapping.get(type_key, ComboBoxDown)
|
|
65
|
+
return cls(self._base_config(config))
|
|
66
|
+
|
|
67
|
+
def create_CheckBox(self, config: dict) -> CheckBox:
|
|
68
|
+
return CheckBox(self._base_config(config))
|
|
69
|
+
|
|
70
|
+
def create_ToggleSwitch(self, config: dict) -> ToggleSwitch:
|
|
71
|
+
return ToggleSwitch(self._base_config(config))
|
|
72
|
+
|
|
73
|
+
def create_Slider(self, config: dict) -> Slider:
|
|
74
|
+
return Slider(self._base_config(config))
|
|
75
|
+
|
|
76
|
+
def create_ProgressBar(self, config: dict) -> ProgressBar:
|
|
77
|
+
return ProgressBar(self._base_config(config, include_sounds=False))
|
|
78
|
+
|
|
79
|
+
def create_Image(self, config: dict) -> Image:
|
|
80
|
+
return Image(self._base_config(config, include_font=False, include_sounds=False))
|
|
81
|
+
|
|
82
|
+
def create_ImageButton(self, config: dict) -> ImageButton:
|
|
83
|
+
return ImageButton(self._base_config(config, include_font=False))
|
|
84
|
+
|
|
85
|
+
def create_RadioButton(self, config: dict) -> RadioButton:
|
|
86
|
+
return RadioButton(self._base_config(config))
|
|
87
|
+
|
|
88
|
+
def create_RadioGroup(self, config: dict | None = None) -> RadioGroup:
|
|
89
|
+
return RadioGroup(config)
|
|
90
|
+
|
|
91
|
+
def create_NumberSpinner(self, config: dict) -> NumberSpinner:
|
|
92
|
+
return NumberSpinner(self._base_config(config))
|
|
93
|
+
|
|
94
|
+
def create_KeybindButton(self, config: dict) -> KeybindButton:
|
|
95
|
+
return KeybindButton(self._base_config(config))
|
|
96
|
+
|
|
97
|
+
def create_Tooltip(self, config: dict) -> Tooltip:
|
|
98
|
+
return Tooltip(self._base_config(config, include_sounds=False))
|
|
99
|
+
|
|
100
|
+
def create_Panel(self, config: dict) -> Panel:
|
|
101
|
+
return Panel(self._base_config(config))
|
|
102
|
+
|
|
103
|
+
def create_StackLayout(self, config: dict) -> StackLayout:
|
|
104
|
+
return StackLayout(self._base_config(config, include_font=False, include_sounds=False))
|
|
105
|
+
|
|
106
|
+
def create_GridLayout(self, config: dict) -> GridLayout:
|
|
107
|
+
return GridLayout(self._base_config(config, include_font=False, include_sounds=False))
|
|
108
|
+
|
|
109
|
+
def create_Modal(self, config: dict) -> Modal:
|
|
110
|
+
return Modal(self._base_config(config))
|
|
111
|
+
|
|
112
|
+
def create_DialogBox(self, config: dict) -> DialogBox:
|
|
113
|
+
return DialogBox(self._base_config(config))
|
|
114
|
+
|
|
115
|
+
def create_TabContainer(self, config: dict) -> TabContainer:
|
|
116
|
+
return TabContainer(self._base_config(config))
|
|
117
|
+
|
|
118
|
+
def create_UIManager(self, config: dict | None = None) -> UIManager:
|
|
119
|
+
cfg = {"screen": self.screen, "window": self.window, "font": self.font, **(config or {})}
|
|
120
|
+
return UIManager(cfg)
|
pyforgeui/UI_Manager.py
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import pygame
|
|
2
|
+
from .Elements.Tooltip import Tooltip
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class UIManager:
|
|
6
|
+
"""High-level UI orchestrator handling Z-order rendering, modal input blocking, and automatic tooltips."""
|
|
7
|
+
|
|
8
|
+
def __init__(self, config: dict) -> None:
|
|
9
|
+
self.screen: pygame.Surface = config["screen"]
|
|
10
|
+
self.window = config.get("window", None)
|
|
11
|
+
self.font: pygame.font.Font = config.get("font", pygame.font.Font(None, 20))
|
|
12
|
+
self.widgets: list = []
|
|
13
|
+
self.modals: list = []
|
|
14
|
+
self.shared_tooltip = Tooltip({
|
|
15
|
+
"screen": self.screen,
|
|
16
|
+
"window": self.window,
|
|
17
|
+
"font": self.font,
|
|
18
|
+
"delay_ms": config.get("tooltip_delay_ms", 350),
|
|
19
|
+
})
|
|
20
|
+
self._hovered_widget = None
|
|
21
|
+
self._hover_start_ticks: int | None = None
|
|
22
|
+
|
|
23
|
+
def add(self, *widgets):
|
|
24
|
+
for w in widgets:
|
|
25
|
+
if w.__class__.__name__ in ("Modal", "DialogBox"):
|
|
26
|
+
if w not in self.modals:
|
|
27
|
+
self.modals.append(w)
|
|
28
|
+
else:
|
|
29
|
+
if w not in self.widgets:
|
|
30
|
+
self.widgets.append(w)
|
|
31
|
+
return widgets[0] if len(widgets) == 1 else widgets
|
|
32
|
+
|
|
33
|
+
def remove(self, widget) -> None:
|
|
34
|
+
if widget in self.widgets:
|
|
35
|
+
self.widgets.remove(widget)
|
|
36
|
+
if widget in self.modals:
|
|
37
|
+
self.modals.remove(widget)
|
|
38
|
+
|
|
39
|
+
def clear(self) -> None:
|
|
40
|
+
self.widgets.clear()
|
|
41
|
+
self.modals.clear()
|
|
42
|
+
|
|
43
|
+
def events(self, event: pygame.event.Event) -> bool:
|
|
44
|
+
for modal in reversed(self.modals):
|
|
45
|
+
if getattr(modal, "visible", False):
|
|
46
|
+
if modal.events(event):
|
|
47
|
+
return True
|
|
48
|
+
for widget in reversed(self.widgets):
|
|
49
|
+
if getattr(widget, "visible", True) and hasattr(widget, "events"):
|
|
50
|
+
if hasattr(widget, "reactivate_pressed"):
|
|
51
|
+
widget.reactivate_pressed(event)
|
|
52
|
+
if widget.events(event):
|
|
53
|
+
return True
|
|
54
|
+
return False
|
|
55
|
+
|
|
56
|
+
def _iter_visible_candidates(self, container_list):
|
|
57
|
+
for item in reversed(container_list):
|
|
58
|
+
if not getattr(item, "visible", True):
|
|
59
|
+
continue
|
|
60
|
+
if hasattr(item, "tabs") and getattr(item, "active_tab", None) in item.tabs:
|
|
61
|
+
yield from self._iter_visible_candidates(item.tabs[item.active_tab])
|
|
62
|
+
if hasattr(item, "children"):
|
|
63
|
+
yield from self._iter_visible_candidates(item.children)
|
|
64
|
+
yield item
|
|
65
|
+
|
|
66
|
+
def _find_tooltip_target(self, mouse_pos: tuple[int, int]):
|
|
67
|
+
for modal in reversed(self.modals):
|
|
68
|
+
if getattr(modal, "visible", False):
|
|
69
|
+
for item in self._iter_visible_candidates(getattr(modal, "children", [])):
|
|
70
|
+
if getattr(item, "tooltip_text", None):
|
|
71
|
+
bounds = item.get_bounding_rect() if hasattr(item, "get_bounding_rect") else getattr(item, "rect", None)
|
|
72
|
+
if isinstance(bounds, pygame.Rect) and bounds.collidepoint(mouse_pos):
|
|
73
|
+
return item
|
|
74
|
+
return None
|
|
75
|
+
|
|
76
|
+
for item in self._iter_visible_candidates(self.widgets):
|
|
77
|
+
if getattr(item, "tooltip_text", None):
|
|
78
|
+
bounds = item.get_bounding_rect() if hasattr(item, "get_bounding_rect") else getattr(item, "rect", None)
|
|
79
|
+
if isinstance(bounds, pygame.Rect) and bounds.collidepoint(mouse_pos):
|
|
80
|
+
return item
|
|
81
|
+
return None
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
def draw(self) -> None:
|
|
85
|
+
for widget in self.widgets:
|
|
86
|
+
if getattr(widget, "visible", True) and hasattr(widget, "draw"):
|
|
87
|
+
widget.draw()
|
|
88
|
+
|
|
89
|
+
for modal in self.modals:
|
|
90
|
+
if getattr(modal, "visible", False) and hasattr(modal, "draw"):
|
|
91
|
+
modal.draw()
|
|
92
|
+
|
|
93
|
+
mouse_pos = self.window.get_mouse_pos() if self.window else pygame.mouse.get_pos()
|
|
94
|
+
target = self._find_tooltip_target(mouse_pos)
|
|
95
|
+
if target is not None:
|
|
96
|
+
now = pygame.time.get_ticks()
|
|
97
|
+
if self._hovered_widget is not target:
|
|
98
|
+
self._hovered_widget = target
|
|
99
|
+
self._hover_start_ticks = now
|
|
100
|
+
elif self._hover_start_ticks is not None and (now - self._hover_start_ticks) >= self.shared_tooltip.delay_ms:
|
|
101
|
+
self.shared_tooltip.draw_at(mouse_pos, target.tooltip_text)
|
|
102
|
+
else:
|
|
103
|
+
self._hovered_widget = None
|
|
104
|
+
self._hover_start_ticks = None
|
pyforgeui/__init__.py
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"""PyForgeUI - Modular and Scalable GUI Library for Pygame."""
|
|
2
|
+
|
|
3
|
+
__version__ = "1.0.0"
|
|
4
|
+
__author__ = "Drakonosinc"
|
|
5
|
+
|
|
6
|
+
from .Elements_Factory import ElementsFactory
|
|
7
|
+
from .UI_Manager import UIManager
|
|
8
|
+
from .Elements import (
|
|
9
|
+
Text,
|
|
10
|
+
TextButton,
|
|
11
|
+
PolygonButton,
|
|
12
|
+
InputText,
|
|
13
|
+
Input_text,
|
|
14
|
+
ScrollBar,
|
|
15
|
+
ComboBox,
|
|
16
|
+
ComboBoxDown,
|
|
17
|
+
ComboBoxUp,
|
|
18
|
+
ComboBoxRight,
|
|
19
|
+
ComboBoxLeft,
|
|
20
|
+
CheckBox,
|
|
21
|
+
ToggleSwitch,
|
|
22
|
+
Slider,
|
|
23
|
+
ProgressBar,
|
|
24
|
+
Image,
|
|
25
|
+
ImageButton,
|
|
26
|
+
RadioButton,
|
|
27
|
+
RadioGroup,
|
|
28
|
+
NumberSpinner,
|
|
29
|
+
KeybindButton,
|
|
30
|
+
Tooltip,
|
|
31
|
+
)
|
|
32
|
+
from .Containers import (
|
|
33
|
+
Panel,
|
|
34
|
+
StackLayout,
|
|
35
|
+
GridLayout,
|
|
36
|
+
Modal,
|
|
37
|
+
DialogBox,
|
|
38
|
+
TabContainer,
|
|
39
|
+
)
|
|
40
|
+
from .Behavior import (
|
|
41
|
+
MouseCollision,
|
|
42
|
+
PressedButton,
|
|
43
|
+
ElementBehavior,
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
__all__ = [
|
|
47
|
+
"__version__",
|
|
48
|
+
"ElementsFactory",
|
|
49
|
+
"UIManager",
|
|
50
|
+
"Text",
|
|
51
|
+
"TextButton",
|
|
52
|
+
"PolygonButton",
|
|
53
|
+
"InputText",
|
|
54
|
+
"Input_text",
|
|
55
|
+
"ScrollBar",
|
|
56
|
+
"ComboBox",
|
|
57
|
+
"ComboBoxDown",
|
|
58
|
+
"ComboBoxUp",
|
|
59
|
+
"ComboBoxRight",
|
|
60
|
+
"ComboBoxLeft",
|
|
61
|
+
"CheckBox",
|
|
62
|
+
"ToggleSwitch",
|
|
63
|
+
"Slider",
|
|
64
|
+
"ProgressBar",
|
|
65
|
+
"Image",
|
|
66
|
+
"ImageButton",
|
|
67
|
+
"RadioButton",
|
|
68
|
+
"RadioGroup",
|
|
69
|
+
"NumberSpinner",
|
|
70
|
+
"KeybindButton",
|
|
71
|
+
"Tooltip",
|
|
72
|
+
"Panel",
|
|
73
|
+
"StackLayout",
|
|
74
|
+
"GridLayout",
|
|
75
|
+
"Modal",
|
|
76
|
+
"DialogBox",
|
|
77
|
+
"TabContainer",
|
|
78
|
+
"MouseCollision",
|
|
79
|
+
"PressedButton",
|
|
80
|
+
"ElementBehavior",
|
|
81
|
+
]
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pyforgeui
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: A modular, zero-leak, game-ready GUI widget and container library built on top of Pygame.
|
|
5
|
+
Author: Drakonosinc
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/Drakonosinc/PyForgeUI
|
|
8
|
+
Project-URL: Repository, https://github.com/Drakonosinc/PyForgeUI
|
|
9
|
+
Project-URL: Documentation, https://deepwiki.com/Drakonosinc/PyForgeUI
|
|
10
|
+
Keywords: pygame,gui,ui,widgets,gamedev,interface,hud,menu
|
|
11
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Topic :: Games/Entertainment
|
|
20
|
+
Classifier: Topic :: Software Development :: User Interfaces
|
|
21
|
+
Requires-Python: >=3.10
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
License-File: LICENSE
|
|
24
|
+
License-File: LICENSE.md
|
|
25
|
+
Requires-Dist: pygame>=2.0.0
|
|
26
|
+
Dynamic: license-file
|
|
27
|
+
|
|
28
|
+
# PyForgeUI
|
|
29
|
+
|
|
30
|
+
[](https://deepwiki.com/Drakonosinc/PyForgeUI)
|
|
31
|
+
[](https://www.python.org/)
|
|
32
|
+
[](LICENSE)
|
|
33
|
+
|
|
34
|
+
**PyForgeUI** is a modular, zero-leak, game-ready GUI widget and container library built on top of **Pygame**. Designed around the `ElementsFactory` and `UIManager` patterns, it lets you build HUDs, RPG inventories, draggable windows, and multi-tab settings screens with cached font surfaces and clean event propagation.
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## Features
|
|
39
|
+
|
|
40
|
+
- **18 Built-in Game Widgets & Containers**:
|
|
41
|
+
- **Core Controls**: `Text`, `TextButton`, `PolygonButton`, `InputText`, `Image`, `ImageButton`
|
|
42
|
+
- **Settings & Value Controls**: `CheckBox`, `ToggleSwitch`, `Slider`, `ProgressBar`, `RadioButton` / `RadioGroup`, `NumberSpinner`, `KeybindButton`
|
|
43
|
+
- **Dropdowns & Scrolling**: `ComboBox` (`down`, `up`, `right`, `left`) & `ScrollBar` (`vertical` & `horizontal` with mouse wheel support)
|
|
44
|
+
- **Containers & Layouts**: `Panel` (draggable & clippable), `StackLayout`, `GridLayout`, `TabContainer`, `Modal` / `DialogBox`
|
|
45
|
+
- **Feedback**: Automatic floating `Tooltip` with hover delay
|
|
46
|
+
- **High Performance (Zero Surface Leaks)**: Text and label surfaces are pre-rendered and cached (`_update_surfaces()`), avoiding per-frame `font.render()` calls.
|
|
47
|
+
- **Z-Order & Modal Input Blocking**: `UIManager` handles top-down event consumption and blocks background clicks when a `Modal` is open.
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## Installation
|
|
52
|
+
|
|
53
|
+
### From PyPI (once published)
|
|
54
|
+
```bash
|
|
55
|
+
pip install pyforgeui
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Local Editable Install (for development or local projects)
|
|
59
|
+
```bash
|
|
60
|
+
pip install -e .
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## Quickstart
|
|
66
|
+
|
|
67
|
+
```python
|
|
68
|
+
import pygame
|
|
69
|
+
from pyforgeui import ElementsFactory
|
|
70
|
+
|
|
71
|
+
pygame.init()
|
|
72
|
+
screen = pygame.display.set_mode((800, 600))
|
|
73
|
+
clock = pygame.time.Clock()
|
|
74
|
+
|
|
75
|
+
factory = ElementsFactory({"screen": screen})
|
|
76
|
+
ui = factory.create_UIManager()
|
|
77
|
+
|
|
78
|
+
panel = factory.create_Panel({
|
|
79
|
+
"position": (200, 120, 400, 320),
|
|
80
|
+
"title": "AUDIO & VIDEO SETTINGS",
|
|
81
|
+
"draggable": True,
|
|
82
|
+
})
|
|
83
|
+
|
|
84
|
+
chk_vsync = factory.create_CheckBox({
|
|
85
|
+
"position": (230, 175),
|
|
86
|
+
"text": "Enable V-Sync",
|
|
87
|
+
"checked": True,
|
|
88
|
+
"tooltip": "Sync frame rate with monitor refresh rate",
|
|
89
|
+
})
|
|
90
|
+
|
|
91
|
+
sld_volume = factory.create_Slider({
|
|
92
|
+
"position": (230, 245, 260, 14),
|
|
93
|
+
"min_value": 0,
|
|
94
|
+
"max_value": 100,
|
|
95
|
+
"value": 80,
|
|
96
|
+
"label": "Master Volume",
|
|
97
|
+
})
|
|
98
|
+
|
|
99
|
+
btn_apply = factory.create_TextButton({
|
|
100
|
+
"position": (230, 310),
|
|
101
|
+
"text": "Apply Changes",
|
|
102
|
+
"command1": lambda: print("Volume:", sld_volume.get_value(), "VSync:", chk_vsync.get_value()),
|
|
103
|
+
})
|
|
104
|
+
|
|
105
|
+
for child in (chk_vsync, sld_volume, btn_apply):
|
|
106
|
+
panel.add_child(child)
|
|
107
|
+
|
|
108
|
+
ui.add(panel)
|
|
109
|
+
|
|
110
|
+
running = True
|
|
111
|
+
while running:
|
|
112
|
+
for event in pygame.event.get():
|
|
113
|
+
if event.type == pygame.QUIT:
|
|
114
|
+
running = False
|
|
115
|
+
else:
|
|
116
|
+
ui.events(event)
|
|
117
|
+
|
|
118
|
+
screen.fill((20, 24, 32))
|
|
119
|
+
ui.draw()
|
|
120
|
+
pygame.display.flip()
|
|
121
|
+
clock.tick(60)
|
|
122
|
+
|
|
123
|
+
pygame.quit()
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
## Complete Interactive RPG Demo
|
|
129
|
+
|
|
130
|
+
Run the included multi-screen game UI showcase (`Main Menu`, `Hero Loadout & HUD`, and `System Configuration`):
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
python demo_game_ui.py
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
---
|
|
137
|
+
|
|
138
|
+
## Running Tests & Building the Package
|
|
139
|
+
|
|
140
|
+
Run the automated test suite:
|
|
141
|
+
```bash
|
|
142
|
+
python -m unittest discover -s tests
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
Build `.whl` and `.tar.gz` distributions for PyPI:
|
|
146
|
+
```bash
|
|
147
|
+
pip install build twine
|
|
148
|
+
python -m build
|
|
149
|
+
twine upload dist/*
|
|
150
|
+
```
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
pyforgeui/Elements_Factory.py,sha256=HuxxbmGoMXyjxAVAHGMoaijoQP20JOFgBZEFlkj5dvY,4759
|
|
2
|
+
pyforgeui/UI_Manager.py,sha256=BnAeuBFW-8GQDLCp8PGc0XsvokMl-DNKClGM1xbati4,4412
|
|
3
|
+
pyforgeui/__init__.py,sha256=83fNICmz0fZCmYk4g3cohEs2u-5T9TFCVHn3GPm7rJo,1404
|
|
4
|
+
pyforgeui/Behavior/Element_behavior.py,sha256=V-FrVEmABgJOQVcLoQnYRELIsVBmKVXlIqFcpdaZIxE,1755
|
|
5
|
+
pyforgeui/Behavior/Mouse_collision.py,sha256=bQrGkkr6dANh8iFuy6fLNqZ8nBdQ3GTUjT_8YxWZcOw,5026
|
|
6
|
+
pyforgeui/Behavior/Pressed_button.py,sha256=3anDfh5yMG-Q9qxZT_xL3HTHrXhVSQyoSpUM_0Z0zGE,3468
|
|
7
|
+
pyforgeui/Behavior/__init__.py,sha256=wMWav2vmn6ngbg59HyHpU4cJucNtFdohQQORqDUEaew,135
|
|
8
|
+
pyforgeui/Containers/Layout.py,sha256=cHQPL2fNY6cH11irvVwMpgnhww_ribN_39saCrScHVE,5918
|
|
9
|
+
pyforgeui/Containers/Modal.py,sha256=7fsLY0CqRyFUHrSM28g7abCtlgh7Z2QV8G9smzl-QoQ,4200
|
|
10
|
+
pyforgeui/Containers/Panel.py,sha256=C-VaWwL6npI9fxNUp-8dLZSbcRppVLLgCPlk0XOa0Os,5313
|
|
11
|
+
pyforgeui/Containers/Tab_container.py,sha256=JFLKx9dIdS9nmfANlSuwGt86dLQnON8yc8ZIz2Vdft0,5410
|
|
12
|
+
pyforgeui/Containers/__init__.py,sha256=CcSUzsl6HTFsv4YDnV1Kf2Kq_Eus6QW5TFiHpN-t5rw,145
|
|
13
|
+
pyforgeui/Elements/Check_box.py,sha256=E2TO-kGncVovjZhKH1NhioW3uQOCBD3k9vcPIlqQz-I,4530
|
|
14
|
+
pyforgeui/Elements/Combo_box.py,sha256=v3VzWdnrNQwQQPdaXQrHV5Cg4TqNhvP3yrrhgeS58t0,17836
|
|
15
|
+
pyforgeui/Elements/Image_element.py,sha256=oVim0w9Kc7HFI168b8W6ie4sGGGyl_wUYiqrvagyui8,3582
|
|
16
|
+
pyforgeui/Elements/Input_text.py,sha256=dasi7BJLVuWZ9T5lfYz-GZjAYcPfyNzKsiVThiWqYfU,2486
|
|
17
|
+
pyforgeui/Elements/Keybind_button.py,sha256=M4NvRpGavdOn6PelzoZRAkZ6O2YOjjvKAOsU0lpam1Y,3632
|
|
18
|
+
pyforgeui/Elements/Number_spinner.py,sha256=hP6U2zuPLPQbEmADoNq2krSCoFWrBY12aNXqeK0-bdc,5093
|
|
19
|
+
pyforgeui/Elements/Polygon_button.py,sha256=uQ1FfgXhYoNRIMJQW_A7ckMnQiAalhm2gVYAHJMpF8M,1082
|
|
20
|
+
pyforgeui/Elements/Progress_bar.py,sha256=ieNmNBDRYO7g0wTiohy2Z_1eWuq--LUonNQthnfV-FI,4245
|
|
21
|
+
pyforgeui/Elements/Radio_button.py,sha256=scRsG2Zzw8a33Sm-ZjZm56oikWtQhCTiBwiX1gCbyyE,5255
|
|
22
|
+
pyforgeui/Elements/Scroll_bar.py,sha256=Z_v28D49jKxBRVbsWY_LME-LplLcIIsS4qTQyec2q_U,9859
|
|
23
|
+
pyforgeui/Elements/Slider.py,sha256=SUNUXX81kPAqi8HqjKMNbSfxYnLFagalLcw_w3ehzQM,6796
|
|
24
|
+
pyforgeui/Elements/Text.py,sha256=96AiCDNPgXoL8aIKdMUC5o76DrYhZIGFZ1tyzcx-zzE,1386
|
|
25
|
+
pyforgeui/Elements/Text_button.py,sha256=qmO83pr4ivqSNNha6hWWJVrwdHPLkoGmqe57KvRxMls,542
|
|
26
|
+
pyforgeui/Elements/Toggle_switch.py,sha256=PHfGTRvM-wzSo5F6a5uYOiFWlX3s7xSmc0PN4buXnJE,4906
|
|
27
|
+
pyforgeui/Elements/Tooltip.py,sha256=gRE8weZXOYCMTxcyPlwjlQsUBZT5ajUN6jn5HwyMpgk,3930
|
|
28
|
+
pyforgeui/Elements/__init__.py,sha256=CN6pYhsdGkRFLclX4FdvXDrVeCdVsVNfV58YSAfb7bA,398
|
|
29
|
+
pyforgeui-1.0.0.dist-info/licenses/LICENSE,sha256=x8s2HRsd0gxpsrFqAlcb7IJQtmeHlejtdJCO181QbO4,1068
|
|
30
|
+
pyforgeui-1.0.0.dist-info/licenses/LICENSE.md,sha256=Y_zDMUosI56de95GVglpC19GilDg_0qu5kgmy4XiwKE,33092
|
|
31
|
+
pyforgeui-1.0.0.dist-info/METADATA,sha256=FjohW6T4nDe1NAiUpjOISiGEi6wEHDx1zdjuY3wpxjQ,4796
|
|
32
|
+
pyforgeui-1.0.0.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
|
|
33
|
+
pyforgeui-1.0.0.dist-info/top_level.txt,sha256=x-EC9cYDovmAsoR38i6ClwUzuXHGXNSonSk8-M9IMqI,10
|
|
34
|
+
pyforgeui-1.0.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Drakonosinc
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|