%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 [![made-with-python](https://img.shields.io/badge/Made%20with-Python-1f425f.svg)](https://www.python.org/) [![dl-pypi](https://img.shields.io/pypi/dm/pygame-popup)](https://pypi.org/project/pygame-popup/) [![license](https://img.shields.io/github/license/grimmys/pygame_popup_manager)](https://github.com/Grimmys/pygame_popup_manager/blob/main/LICENSE) [![version](https://img.shields.io/pypi/v/pygame-popup)](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: ![Main menu with side menu](https://github.com/Grimmys/pygame_popup_manager/blob/main/screenshots/main_menu_with_side_menu.png) # 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: ![Options menu with assets](https://github.com/Grimmys/pygame_popup_manager/blob/main/screenshots/options_menu_with_assets.png) # 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 [![made-with-python](https://img.shields.io/badge/Made%20with-Python-1f425f.svg)](https://www.python.org/) [![dl-pypi](https://img.shields.io/pypi/dm/pygame-popup)](https://pypi.org/project/pygame-popup/) [![license](https://img.shields.io/github/license/grimmys/pygame_popup_manager)](https://github.com/Grimmys/pygame_popup_manager/blob/main/LICENSE) [![version](https://img.shields.io/pypi/v/pygame-popup)](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: ![Main menu with side menu](https://github.com/Grimmys/pygame_popup_manager/blob/main/screenshots/main_menu_with_side_menu.png) # 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: ![Options menu with assets](https://github.com/Grimmys/pygame_popup_manager/blob/main/screenshots/options_menu_with_assets.png) # 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 [![made-with-python](https://img.shields.io/badge/Made%20with-Python-1f425f.svg)](https://www.python.org/) [![dl-pypi](https://img.shields.io/pypi/dm/pygame-popup)](https://pypi.org/project/pygame-popup/) [![license](https://img.shields.io/github/license/grimmys/pygame_popup_manager)](https://github.com/Grimmys/pygame_popup_manager/blob/main/LICENSE) [![version](https://img.shields.io/pypi/v/pygame-popup)](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: ![Main menu with side menu](https://github.com/Grimmys/pygame_popup_manager/blob/main/screenshots/main_menu_with_side_menu.png) # 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: ![Options menu with assets](https://github.com/Grimmys/pygame_popup_manager/blob/main/screenshots/options_menu_with_assets.png) # 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 - 0.7.0-1 - Package Spec generated