pygets 1.0.0__tar.gz

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.
Files changed (37) hide show
  1. pygets-1.0.0/LICENSE +21 -0
  2. pygets-1.0.0/MANIFEST.in +6 -0
  3. pygets-1.0.0/PKG-INFO +132 -0
  4. pygets-1.0.0/README.md +105 -0
  5. pygets-1.0.0/docs/CONTRIBUTING.md +71 -0
  6. pygets-1.0.0/docs/customization.md +240 -0
  7. pygets-1.0.0/docs/getting-started.md +180 -0
  8. pygets-1.0.0/docs/index.md +103 -0
  9. pygets-1.0.0/pygets/__init__.py +34 -0
  10. pygets-1.0.0/pygets/core/__init__.py +0 -0
  11. pygets-1.0.0/pygets/core/theme.py +109 -0
  12. pygets-1.0.0/pygets/core/widgets.py +24 -0
  13. pygets-1.0.0/pygets/utils/__init__.py +0 -0
  14. pygets-1.0.0/pygets/utils/colors.py +55 -0
  15. pygets-1.0.0/pygets/utils/validators.py +135 -0
  16. pygets-1.0.0/pygets/widgets/__init__.py +17 -0
  17. pygets-1.0.0/pygets/widgets/button.py +221 -0
  18. pygets-1.0.0/pygets/widgets/checkbox.py +155 -0
  19. pygets-1.0.0/pygets/widgets/combobox.py +235 -0
  20. pygets-1.0.0/pygets/widgets/popup.py +294 -0
  21. pygets-1.0.0/pygets/widgets/slider.py +117 -0
  22. pygets-1.0.0/pygets/widgets/textbox.py +226 -0
  23. pygets-1.0.0/pygets/widgets/togglebutton.py +88 -0
  24. pygets-1.0.0/pygets.egg-info/PKG-INFO +132 -0
  25. pygets-1.0.0/pygets.egg-info/SOURCES.txt +35 -0
  26. pygets-1.0.0/pygets.egg-info/dependency_links.txt +1 -0
  27. pygets-1.0.0/pygets.egg-info/requires.txt +7 -0
  28. pygets-1.0.0/pygets.egg-info/top_level.txt +1 -0
  29. pygets-1.0.0/pyproject.toml +43 -0
  30. pygets-1.0.0/setup.cfg +4 -0
  31. pygets-1.0.0/tests/test_button.py +72 -0
  32. pygets-1.0.0/tests/test_checkbox.py +74 -0
  33. pygets-1.0.0/tests/test_combobox.py +110 -0
  34. pygets-1.0.0/tests/test_popup.py +111 -0
  35. pygets-1.0.0/tests/test_slider.py +91 -0
  36. pygets-1.0.0/tests/test_textbox.py +171 -0
  37. pygets-1.0.0/tests/test_togglebutton.py +78 -0
pygets-1.0.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 ZentarDev
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.
@@ -0,0 +1,6 @@
1
+ include README.md
2
+ include LICENSE
3
+ recursive-include pygets *.py
4
+ recursive-include docs *.md
5
+ global-exclude __pycache__
6
+ global-exclude *.py[cod]
pygets-1.0.0/PKG-INFO ADDED
@@ -0,0 +1,132 @@
1
+ Metadata-Version: 2.4
2
+ Name: pygets
3
+ Version: 1.0.0
4
+ Summary: GUI widgets toolkit for pygame
5
+ Author: ZentarDev
6
+ License-Expression: MIT
7
+ Keywords: pygame,gui,widgets,ui,game-dev
8
+ Classifier: Development Status :: 4 - Beta
9
+ Classifier: Intended Audience :: Developers
10
+ Classifier: Operating System :: OS Independent
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Programming Language :: Python :: 3.10
13
+ Classifier: Programming Language :: Python :: 3.11
14
+ Classifier: Programming Language :: Python :: 3.12
15
+ Classifier: Topic :: Software Development :: User Interfaces
16
+ Classifier: Topic :: Games/Entertainment
17
+ Requires-Python: >=3.10
18
+ Description-Content-Type: text/markdown
19
+ License-File: LICENSE
20
+ Requires-Dist: pygame
21
+ Requires-Dist: pyperclip
22
+ Provides-Extra: dev
23
+ Requires-Dist: build>=1.2.2; extra == "dev"
24
+ Requires-Dist: pytest>=8.0; extra == "dev"
25
+ Requires-Dist: twine>=5.1.0; extra == "dev"
26
+ Dynamic: license-file
27
+
28
+ # PyGets
29
+
30
+ PyGets is a lightweight widget toolkit for building small interfaces with `pygame`.
31
+
32
+ It provides reusable UI components for rapid prototypes, tools, menus, and simple applications without introducing a larger GUI framework.
33
+
34
+ ## Features
35
+
36
+ - `Button`
37
+ - `Checkbox`
38
+ - `Combobox`
39
+ - `Popup`
40
+ - `Slider`
41
+ - `Textbox`
42
+ - `Togglebutton`
43
+ - Built-in theme system with multiple predefined themes
44
+
45
+ ## Installation
46
+
47
+ After publishing to PyPI, users can install PyGets with:
48
+
49
+ ```bash
50
+ pip install pygets
51
+ ```
52
+
53
+ For local development from this repository:
54
+
55
+ ```bash
56
+ pip install -e .[dev]
57
+ ```
58
+
59
+ ## Quick Start
60
+
61
+ ```python
62
+ import pygame
63
+
64
+ from pygets.core.theme import themes
65
+ from pygets.widgets import Button
66
+
67
+ pygame.init()
68
+
69
+ screen = pygame.display.set_mode((800, 500))
70
+ pygame.display.set_caption("PyGets Demo")
71
+
72
+ font = pygame.font.Font(None, 28)
73
+ button = Button(
74
+ x=80,
75
+ y=80,
76
+ font=font,
77
+ screen=screen,
78
+ theme=themes["light"],
79
+ text="Click me",
80
+ )
81
+
82
+ clock = pygame.time.Clock()
83
+ running = True
84
+
85
+ while running:
86
+ clock.tick(60)
87
+
88
+ for event in pygame.event.get():
89
+ if event.type == pygame.QUIT:
90
+ running = False
91
+ if event.type == pygame.MOUSEBUTTONDOWN and event.button == 1:
92
+ if button.rect.collidepoint(event.pos):
93
+ print("Button pressed")
94
+
95
+ screen.fill((96, 140, 168))
96
+ button.draw()
97
+ pygame.display.flip()
98
+
99
+ pygame.quit()
100
+ ```
101
+
102
+ ## Development
103
+
104
+ Install development dependencies:
105
+
106
+ ```bash
107
+ pip install -e .[dev]
108
+ ```
109
+
110
+ Run the test suite:
111
+
112
+ ```bash
113
+ pytest tests
114
+ ```
115
+
116
+ Build release artifacts:
117
+
118
+ ```bash
119
+ python -m build
120
+ python -m twine check dist/*
121
+ ```
122
+
123
+ ## Documentation
124
+
125
+ - User docs: `docs/`
126
+ - Examples: `examples/`
127
+ - Contribution guide: `docs/CONTRIBUTING.md`
128
+ - Release guide: `RELEASING.md`
129
+
130
+ ## License
131
+
132
+ PyGets is distributed under the MIT License. See `LICENSE`.
pygets-1.0.0/README.md ADDED
@@ -0,0 +1,105 @@
1
+ # PyGets
2
+
3
+ PyGets is a lightweight widget toolkit for building small interfaces with `pygame`.
4
+
5
+ It provides reusable UI components for rapid prototypes, tools, menus, and simple applications without introducing a larger GUI framework.
6
+
7
+ ## Features
8
+
9
+ - `Button`
10
+ - `Checkbox`
11
+ - `Combobox`
12
+ - `Popup`
13
+ - `Slider`
14
+ - `Textbox`
15
+ - `Togglebutton`
16
+ - Built-in theme system with multiple predefined themes
17
+
18
+ ## Installation
19
+
20
+ After publishing to PyPI, users can install PyGets with:
21
+
22
+ ```bash
23
+ pip install pygets
24
+ ```
25
+
26
+ For local development from this repository:
27
+
28
+ ```bash
29
+ pip install -e .[dev]
30
+ ```
31
+
32
+ ## Quick Start
33
+
34
+ ```python
35
+ import pygame
36
+
37
+ from pygets.core.theme import themes
38
+ from pygets.widgets import Button
39
+
40
+ pygame.init()
41
+
42
+ screen = pygame.display.set_mode((800, 500))
43
+ pygame.display.set_caption("PyGets Demo")
44
+
45
+ font = pygame.font.Font(None, 28)
46
+ button = Button(
47
+ x=80,
48
+ y=80,
49
+ font=font,
50
+ screen=screen,
51
+ theme=themes["light"],
52
+ text="Click me",
53
+ )
54
+
55
+ clock = pygame.time.Clock()
56
+ running = True
57
+
58
+ while running:
59
+ clock.tick(60)
60
+
61
+ for event in pygame.event.get():
62
+ if event.type == pygame.QUIT:
63
+ running = False
64
+ if event.type == pygame.MOUSEBUTTONDOWN and event.button == 1:
65
+ if button.rect.collidepoint(event.pos):
66
+ print("Button pressed")
67
+
68
+ screen.fill((96, 140, 168))
69
+ button.draw()
70
+ pygame.display.flip()
71
+
72
+ pygame.quit()
73
+ ```
74
+
75
+ ## Development
76
+
77
+ Install development dependencies:
78
+
79
+ ```bash
80
+ pip install -e .[dev]
81
+ ```
82
+
83
+ Run the test suite:
84
+
85
+ ```bash
86
+ pytest tests
87
+ ```
88
+
89
+ Build release artifacts:
90
+
91
+ ```bash
92
+ python -m build
93
+ python -m twine check dist/*
94
+ ```
95
+
96
+ ## Documentation
97
+
98
+ - User docs: `docs/`
99
+ - Examples: `examples/`
100
+ - Contribution guide: `docs/CONTRIBUTING.md`
101
+ - Release guide: `RELEASING.md`
102
+
103
+ ## License
104
+
105
+ PyGets is distributed under the MIT License. See `LICENSE`.
@@ -0,0 +1,71 @@
1
+ # Contributing to Pygets
2
+
3
+ Thank you for your interest in contributing to Pygets! This document provides guidelines and information to help you get started.
4
+
5
+ ## Table of Contents
6
+
7
+ - [Getting Started](#getting-started)
8
+ - [Development Setup](#development-setup)
9
+ - [Coding Standards](#coding-standards)
10
+ - [Testing](#testing)
11
+ - [Submitting Changes](#submitting-changes)
12
+ - [Reporting Issues](#reporting-issues)
13
+
14
+ ## Getting Started
15
+
16
+ Pygets is a Python library for creating GUI widgets. Contributions are welcome in the form of bug fixes, new features, documentation improvements, or tests.
17
+
18
+ Before contributing, please:
19
+
20
+ 1. Fork the repository on GitHub.
21
+ 2. Clone your fork locally.
22
+ 3. Create a new branch for your changes.
23
+
24
+ ## Development Setup
25
+
26
+ To set up a development environment:
27
+
28
+ 1. Ensure you have Python 3.10+ installed.
29
+ 2. Install the project in editable mode with development tools:
30
+ ```bash
31
+ pip install -e .[dev]
32
+ ```
33
+ 3. Run the test suite before opening a pull request.
34
+
35
+ The project structure is as follows:
36
+
37
+ - `pygets/`: Main source code
38
+ - `core/`: Core functionality (theme.py, widgets.py)
39
+ - `utils/`: Utilities (colors.py, validators.py)
40
+ - `widgets/`: Widget implementations (button.py, checkbox.py, etc.)
41
+ - `tests/`: Unit tests for each widget (test_button.py, test_checkbox.py, etc.)
42
+
43
+ ## Coding Standards
44
+
45
+ - Follow PEP 8 style guidelines.
46
+ - Use descriptive variable and function names.
47
+ - Add docstrings to all public functions and classes.
48
+ - Keep lines under 80 characters where possible.
49
+
50
+ ## Testing
51
+
52
+ Pygets uses pytest for testing. To run tests:
53
+
54
+ ```bash
55
+ pytest tests
56
+ ```
57
+
58
+ Ensure all tests pass before submitting changes. Add tests for new features or bug fixes.
59
+
60
+ ## Submitting Changes
61
+
62
+ 1. Commit your changes with clear, descriptive messages.
63
+ 2. Push to your fork.
64
+ 3. Create a pull request on GitHub.
65
+ 4. Describe the changes and reference any related issues.
66
+
67
+ ## Reporting Issues
68
+
69
+ If you find a bug or have a feature request, please open an issue on GitHub. Provide as much detail as possible, including steps to reproduce.
70
+
71
+ We appreciate your contributions!
@@ -0,0 +1,240 @@
1
+ # Customization
2
+
3
+ PyGets customization is centered around `Theme` objects plus a few widget-level sizing and layout parameters.
4
+
5
+ ## Theme model
6
+
7
+ Each theme defines five color roles:
8
+
9
+ - `background`
10
+ - `foreground`
11
+ - `accent`
12
+ - `idle`
13
+ - `text`
14
+
15
+ The `Theme` class is available from `pygets.core.theme`.
16
+
17
+ ```python
18
+ from pygets.core.theme import Theme
19
+
20
+ custom_theme = Theme(
21
+ name="custom",
22
+ background=(28, 28, 32),
23
+ foreground=(240, 240, 240),
24
+ accent=(80, 180, 255),
25
+ idle=(110, 110, 120),
26
+ text=(255, 255, 255),
27
+ )
28
+ ```
29
+
30
+ ## Built-in themes
31
+
32
+ PyGets ships with these predefined themes in `pygets.core.theme.themes`:
33
+
34
+ - `light`
35
+ - `dark`
36
+ - `forest`
37
+ - `ocean`
38
+ - `sunset`
39
+ - `purple_night`
40
+ - `silver`
41
+
42
+ Example:
43
+
44
+ ```python
45
+ from pygets.core.theme import themes
46
+
47
+ theme = themes["forest"]
48
+ ```
49
+
50
+ ## Built-in color palette
51
+
52
+ If you prefer named RGB values instead of hardcoding tuples, use `pygets.utils.colors.colors`.
53
+
54
+ Examples available in the palette include:
55
+
56
+ - `WHITE`, `BLACK`, `GRAY`, `DARK_GRAY`
57
+ - `BLUE`, `LIGHT_BLUE`, `TURQUOISE`
58
+ - `GREEN`, `LIGHT_GREEN`, `MINT_GREEN`, `OLIVE`
59
+ - `DARK_ORANGE`, `GOLD`, `PURPLE`, `LAVENDER`
60
+ - `SAND`, `SILVER`, `BLUISH_GRAY`
61
+
62
+ ```python
63
+ from pygets.core.theme import Theme
64
+ from pygets.utils.colors import colors
65
+
66
+ theme = Theme(
67
+ name="studio",
68
+ background=colors["BLACK"],
69
+ foreground=colors["WHITE"],
70
+ accent=colors["TURQUOISE"],
71
+ idle=colors["DARK_GRAY"],
72
+ text=colors["WHITE"],
73
+ )
74
+ ```
75
+
76
+ ## Widget-level customization
77
+
78
+ ### Button
79
+
80
+ Useful parameters:
81
+
82
+ - `width` and `height` to override auto sizing
83
+ - `image` to add an icon
84
+ - `text` to show a label
85
+ - `edges` to enable or disable the border
86
+ - `border_radius` for corner roundness
87
+ - `spacing` for image/text separation
88
+
89
+ ```python
90
+ button = Button(
91
+ x=40,
92
+ y=40,
93
+ font=font,
94
+ screen=screen,
95
+ theme=theme,
96
+ text="Export",
97
+ width=200,
98
+ border_radius=24,
99
+ spacing=12,
100
+ )
101
+ ```
102
+
103
+ ### Checkbox
104
+
105
+ Useful parameters:
106
+
107
+ - `checked` for the initial state
108
+ - `size` for the box size
109
+ - `border_radius` for square vs rounded corners
110
+
111
+ ```python
112
+ checkbox = Checkbox(
113
+ x=40,
114
+ y=120,
115
+ screen=screen,
116
+ theme=theme,
117
+ checked=True,
118
+ size=24,
119
+ border_radius=6,
120
+ )
121
+ ```
122
+
123
+ ### Combobox
124
+
125
+ Useful parameters:
126
+
127
+ - `width` and `height`
128
+ - `options`
129
+ - `border_radius`
130
+
131
+ ```python
132
+ combo = Combobox(
133
+ x=40,
134
+ y=180,
135
+ width=260,
136
+ height=36,
137
+ screen=screen,
138
+ options=["Python", "Rust", "Go"],
139
+ font=font,
140
+ theme=theme,
141
+ border_radius=12,
142
+ )
143
+ ```
144
+
145
+ ### Textbox
146
+
147
+ Useful parameters:
148
+
149
+ - `placeholder`
150
+ - `width`
151
+ - `max_characters`
152
+ - `border_radius`
153
+ - `function` callback when Enter is pressed
154
+
155
+ ```python
156
+ textbox = Textbox(
157
+ x=40,
158
+ y=250,
159
+ screen=screen,
160
+ font=font,
161
+ theme=theme,
162
+ placeholder="Write your email...",
163
+ width=360,
164
+ max_characters=120,
165
+ border_radius=14,
166
+ )
167
+ ```
168
+
169
+ ### Slider
170
+
171
+ Useful parameters:
172
+
173
+ - `width` and `height`
174
+ - `min_val`
175
+ - `max_val`
176
+ - `initial_value`
177
+
178
+ ```python
179
+ slider = Slider(
180
+ x=40,
181
+ y=330,
182
+ width=300,
183
+ height=8,
184
+ screen=screen,
185
+ theme=theme,
186
+ min_val=0,
187
+ max_val=1,
188
+ initial_value=0.5,
189
+ )
190
+ ```
191
+
192
+ ### Togglebutton
193
+
194
+ Useful parameters:
195
+
196
+ - `width` and `height`
197
+ - `active`
198
+
199
+ ```python
200
+ toggle = Togglebutton(
201
+ x=40,
202
+ y=390,
203
+ screen=screen,
204
+ theme=theme,
205
+ width=72,
206
+ height=36,
207
+ active=True,
208
+ )
209
+ ```
210
+
211
+ ### Popup
212
+
213
+ Useful parameters:
214
+
215
+ - `title` and `message`
216
+ - `width` and `height`
217
+ - `font` and `title_font`
218
+ - `theme`
219
+
220
+ ```python
221
+ popup = Popup(
222
+ title="Saved",
223
+ message="Your settings were updated successfully.",
224
+ font=font,
225
+ title_font=title_font,
226
+ screen=screen,
227
+ screen_width=800,
228
+ screen_height=600,
229
+ width=420,
230
+ height=220,
231
+ theme=theme,
232
+ )
233
+ ```
234
+
235
+ ## Practical guidance
236
+
237
+ - Use `theme.background` for widget surfaces and a separate window background for contrast.
238
+ - Keep `theme.text` and `theme.foreground` high-contrast, especially for `Textbox` and `Combobox`.
239
+ - Prefer larger `border_radius` values for soft UI and small values for more compact tooling interfaces.
240
+ - When a widget supports hover, `theme.idle` controls the overlay tint that appears on pointer focus.