Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PACKAGE/DEFCONFIG] add PYGAME along side with new pkg PYGAME_MENU #72

Merged
merged 4 commits into from
Jan 3, 2024

Conversation

Apaczer
Copy link
Member

@Apaczer Apaczer commented Dec 28, 2023

pygame as Simple SDL interpreter (see pyClock) + pygame-menu for drawing GUIs acting as task-tool.

e.g.:

#!/usr/bin/python3

import pygame_menu
from pygame_menu.examples import create_example_window

from typing import Tuple, Any

surface = create_example_window('Example - Simple', (320, 240))


def set_difficulty(selected: Tuple, value: Any) -> None:
    print(f'Set difficulty to {selected[0]} ({value})')

def start_the_game() -> None:
    global user_name
    print(f'{user_name.get_value()}, Do the job here!')

menu = pygame_menu.Menu(
    height=240,
    theme=pygame_menu.themes.THEME_BLUE,
    title='MiyooCFW',
    width=320
)

user_name = menu.add.text_input('Version: ', default='2.0', maxchar=10)
menu.add.selector('Option: ', [('No.1', 1), ('No.2', 2)], onchange=set_difficulty)
menu.add.button('Start', start_the_game)
menu.add.button('Quit', pygame_menu.events.EXIT)

if __name__ == '__main__':
    menu.mainloop(surface)

@Apaczer Apaczer merged commit c6cc029 into MiyooCFW:master Jan 3, 2024
@Apaczer Apaczer deleted the pygame branch January 3, 2024 14:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant