1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
|
%global _empty_manifest_terminate_build 0
Name: python-pygame-popup
Version: 0.7.0
Release: 1
Summary: A popup manager for pygame
License: GNU General Public License (GPL)
URL: https://github.com/Grimmys/pygame_popup_manager
Source0: https://mirrors.aliyun.com/pypi/web/packages/9e/6b/082a051624819247c67ade77b50da1c90a8cba88c8e38bede8435242c23e/pygame-popup-0.7.0.tar.gz
BuildArch: noarch
Requires: python3-pygame
%description
# Pygame Popup Manager
[](https://www.python.org/)
[](https://pypi.org/project/pygame-popup/)
[](https://github.com/Grimmys/pygame_popup_manager/blob/main/LICENSE)
[](https://pypi.org/project/pygame-popup/)
Docs are now available at: https://pygame-popup-manager.readthedocs.io/en/latest/
Pygame Popup Manager is a very small engine permitting to easily build all kind of popup in a pygame project.
Here is an example of basic menus that could be created with this manager:

# Installation
The easiest way to install this package is to do it with `pip`:
`pip install pygame-popup`
# Use
First, don't forget to call `pygamepopup.init` function right after
calling `pygame.init` function.
The whole system is working around the `MenuManager` class that is
the controller of all the popups in background and in foreground.
An unique instance per scene/window has to be created and the pygame screen
on which the popups will appear should be provided, like this:
```py
from pygamepopup.menu_manager import MenuManager
menu_manager = MenuManager(screen)
```
The `display`, `motion` and `click` methods of this class should be called in the application main loop
in order to notify the manager of any pygame event.
To open a new popup menu, you should first create it by instantiate the `InfoBox` class.
The components that should be in the menu should be provided.
Next, don't forget to call the `open_menu` method of the menu manager to notify it about the new menu.
For example, the following code will open a popup with a "do-nothing" button and a close button (added by default by the `InfoBox`)
```py
from pygamepopup.components import Button, InfoBox
my_custom_menu = InfoBox(
"Title of the Menu",
[
Button(
title="Hello World!",
callback=lambda: None
)
]
)
menu_manager.open_menu(my_custom_menu)
```
If you want more code illustrations, check the `examples/minimal_main_menu.py` module.
# Customization
The default graphics resources can be easily changed by your own by simply calling certain methods of the `configuration` module, wherever you want, as can be seen below.
```py
import pygamepopup
pygamepopup.configuration.set_button_background("sprites/inactive_button.png",
"sprites/active_button.png")
pygamepopup.configuration.set_dynamic_button_background("sprites/inactive_button.png",
"sprites/active_button.png")
pygamepopup.configuration.set_info_box_background("sprites/menu_box.png")
```
It is also possible to directly provide an asset to a specific component, if you want a button to be different from others for example.
```py
Button(
title="Hello World!",
callback=lambda: None,
sprite=pygame.image.load("sprites/different_button.png"),
sprite_hover=pygame.image.load("sprites/different_button_hover.png")
)
```
With this kind of configuration you can made an interface similar to this one:

# Contact
You can contact me directly by [e-mail](mailto:grimmys.programming@gmail.com?subject=[GitHub]%20Pygame%20Popup%20Manager) if you have any question regarding the package.
Also, I will be really happy to know you are using this package, so don't hesitate to share me the link to your project if you tried something!
For suggestions or bugs, please create an issue in the GitHub repository: https://github.com/Grimmys/pygame_popup_manager/issues
Thanks!
%package -n python3-pygame-popup
Summary: A popup manager for pygame
Provides: python-pygame-popup
BuildRequires: python3-devel
BuildRequires: python3-setuptools
BuildRequires: python3-pip
%description -n python3-pygame-popup
# Pygame Popup Manager
[](https://www.python.org/)
[](https://pypi.org/project/pygame-popup/)
[](https://github.com/Grimmys/pygame_popup_manager/blob/main/LICENSE)
[](https://pypi.org/project/pygame-popup/)
Docs are now available at: https://pygame-popup-manager.readthedocs.io/en/latest/
Pygame Popup Manager is a very small engine permitting to easily build all kind of popup in a pygame project.
Here is an example of basic menus that could be created with this manager:

# Installation
The easiest way to install this package is to do it with `pip`:
`pip install pygame-popup`
# Use
First, don't forget to call `pygamepopup.init` function right after
calling `pygame.init` function.
The whole system is working around the `MenuManager` class that is
the controller of all the popups in background and in foreground.
An unique instance per scene/window has to be created and the pygame screen
on which the popups will appear should be provided, like this:
```py
from pygamepopup.menu_manager import MenuManager
menu_manager = MenuManager(screen)
```
The `display`, `motion` and `click` methods of this class should be called in the application main loop
in order to notify the manager of any pygame event.
To open a new popup menu, you should first create it by instantiate the `InfoBox` class.
The components that should be in the menu should be provided.
Next, don't forget to call the `open_menu` method of the menu manager to notify it about the new menu.
For example, the following code will open a popup with a "do-nothing" button and a close button (added by default by the `InfoBox`)
```py
from pygamepopup.components import Button, InfoBox
my_custom_menu = InfoBox(
"Title of the Menu",
[
Button(
title="Hello World!",
callback=lambda: None
)
]
)
menu_manager.open_menu(my_custom_menu)
```
If you want more code illustrations, check the `examples/minimal_main_menu.py` module.
# Customization
The default graphics resources can be easily changed by your own by simply calling certain methods of the `configuration` module, wherever you want, as can be seen below.
```py
import pygamepopup
pygamepopup.configuration.set_button_background("sprites/inactive_button.png",
"sprites/active_button.png")
pygamepopup.configuration.set_dynamic_button_background("sprites/inactive_button.png",
"sprites/active_button.png")
pygamepopup.configuration.set_info_box_background("sprites/menu_box.png")
```
It is also possible to directly provide an asset to a specific component, if you want a button to be different from others for example.
```py
Button(
title="Hello World!",
callback=lambda: None,
sprite=pygame.image.load("sprites/different_button.png"),
sprite_hover=pygame.image.load("sprites/different_button_hover.png")
)
```
With this kind of configuration you can made an interface similar to this one:

# Contact
You can contact me directly by [e-mail](mailto:grimmys.programming@gmail.com?subject=[GitHub]%20Pygame%20Popup%20Manager) if you have any question regarding the package.
Also, I will be really happy to know you are using this package, so don't hesitate to share me the link to your project if you tried something!
For suggestions or bugs, please create an issue in the GitHub repository: https://github.com/Grimmys/pygame_popup_manager/issues
Thanks!
%package help
Summary: Development documents and examples for pygame-popup
Provides: python3-pygame-popup-doc
%description help
# Pygame Popup Manager
[](https://www.python.org/)
[](https://pypi.org/project/pygame-popup/)
[](https://github.com/Grimmys/pygame_popup_manager/blob/main/LICENSE)
[](https://pypi.org/project/pygame-popup/)
Docs are now available at: https://pygame-popup-manager.readthedocs.io/en/latest/
Pygame Popup Manager is a very small engine permitting to easily build all kind of popup in a pygame project.
Here is an example of basic menus that could be created with this manager:

# Installation
The easiest way to install this package is to do it with `pip`:
`pip install pygame-popup`
# Use
First, don't forget to call `pygamepopup.init` function right after
calling `pygame.init` function.
The whole system is working around the `MenuManager` class that is
the controller of all the popups in background and in foreground.
An unique instance per scene/window has to be created and the pygame screen
on which the popups will appear should be provided, like this:
```py
from pygamepopup.menu_manager import MenuManager
menu_manager = MenuManager(screen)
```
The `display`, `motion` and `click` methods of this class should be called in the application main loop
in order to notify the manager of any pygame event.
To open a new popup menu, you should first create it by instantiate the `InfoBox` class.
The components that should be in the menu should be provided.
Next, don't forget to call the `open_menu` method of the menu manager to notify it about the new menu.
For example, the following code will open a popup with a "do-nothing" button and a close button (added by default by the `InfoBox`)
```py
from pygamepopup.components import Button, InfoBox
my_custom_menu = InfoBox(
"Title of the Menu",
[
Button(
title="Hello World!",
callback=lambda: None
)
]
)
menu_manager.open_menu(my_custom_menu)
```
If you want more code illustrations, check the `examples/minimal_main_menu.py` module.
# Customization
The default graphics resources can be easily changed by your own by simply calling certain methods of the `configuration` module, wherever you want, as can be seen below.
```py
import pygamepopup
pygamepopup.configuration.set_button_background("sprites/inactive_button.png",
"sprites/active_button.png")
pygamepopup.configuration.set_dynamic_button_background("sprites/inactive_button.png",
"sprites/active_button.png")
pygamepopup.configuration.set_info_box_background("sprites/menu_box.png")
```
It is also possible to directly provide an asset to a specific component, if you want a button to be different from others for example.
```py
Button(
title="Hello World!",
callback=lambda: None,
sprite=pygame.image.load("sprites/different_button.png"),
sprite_hover=pygame.image.load("sprites/different_button_hover.png")
)
```
With this kind of configuration you can made an interface similar to this one:

# Contact
You can contact me directly by [e-mail](mailto:grimmys.programming@gmail.com?subject=[GitHub]%20Pygame%20Popup%20Manager) if you have any question regarding the package.
Also, I will be really happy to know you are using this package, so don't hesitate to share me the link to your project if you tried something!
For suggestions or bugs, please create an issue in the GitHub repository: https://github.com/Grimmys/pygame_popup_manager/issues
Thanks!
%prep
%autosetup -n pygame-popup-0.7.0
%build
%py3_build
%install
%py3_install
install -d -m755 %{buildroot}/%{_pkgdocdir}
if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi
if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi
if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi
if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi
pushd %{buildroot}
if [ -d usr/lib ]; then
find usr/lib -type f -printf "\"/%h/%f\"\n" >> filelist.lst
fi
if [ -d usr/lib64 ]; then
find usr/lib64 -type f -printf "\"/%h/%f\"\n" >> filelist.lst
fi
if [ -d usr/bin ]; then
find usr/bin -type f -printf "\"/%h/%f\"\n" >> filelist.lst
fi
if [ -d usr/sbin ]; then
find usr/sbin -type f -printf "\"/%h/%f\"\n" >> filelist.lst
fi
touch doclist.lst
if [ -d usr/share/man ]; then
find usr/share/man -type f -printf "\"/%h/%f.gz\"\n" >> doclist.lst
fi
popd
mv %{buildroot}/filelist.lst .
mv %{buildroot}/doclist.lst .
%files -n python3-pygame-popup -f filelist.lst
%dir %{python3_sitelib}/*
%files help -f doclist.lst
%{_docdir}/*
%changelog
* Tue Jun 20 2023 Python_Bot <Python_Bot@openeuler.org> - 0.7.0-1
- Package Spec generated
|