예제 #1
0
def newGame():
    state = State()
    items = []
    items.append(m.MenuItem('Classic', startClassic))
    items.append(m.MenuItem('Random', startRandom))
    items.append(m.MenuItem('Main Menu', backToMainMenu))
    state.current = m.Menu(state, items)
예제 #2
0
def auto_comidas(v):

    n = len(v)
    entradas = ('Empanada', 'Tabla de fiambres', 'Dips variados', 'Buffet')
    principal = ('Pollo al Grill con verduras salteadas', 'Tira de Asado',
                 'Ravioles de verdura', 'Canelones con salsa Bolognesa',
                 'Matambre de cerdo asado')
    postre = ('Frutillas a la crema', 'Flan con dulce de leche',
              'Torta tentación', 'Lemon Pie', 'Helado de frutilla y chocolate')

    for i in range(n):
        tipo = random.randint(0, 2)

        if tipo == 0:
            nom = random.choice(entradas)
        elif tipo == 1:
            nom = random.choice(principal)
        elif tipo == 2:
            nom = random.choice(postre)

        clas = random.randint(0, 3)
        tiem = round(random.random() * 90, 2)
        pre = round(random.random() * 200, 2)

        v[i] = menus.Menu(tipo, nom, clas, tiem, pre)

    print()
예제 #3
0
def menu_header():

    # Print Import Message Above
    output_menu = menus.Menu("file_out", menus.EXPORT_MENU_LIST,
                             menus.EXPORT_MENU_ROUTE)
    output_menu.print_menu_message()
    output_menu.display_shift_menu()
예제 #4
0
def main():
    # basic init
    os.environ['SDL_VIDEO_CENTERED'] = '1'
    pygame.init()
    pygame.font.init()

    # setup the screen, double buffer and game clock
    state = State()
    state.screen = pygame.display.set_mode(state.size, state.fullscreen)
    clock = pygame.time.Clock()

    # create main menu
    items = []
    items.append(m.MenuItem('New Game', newGame))
    items.append(m.MenuItem('Options', videoOptions))
    items.append(m.MenuItem('Quit', quit))
    options = ['New Game', 'Quit']

    # start in the main menu
    mainMenu = m.Menu(state, items)
    state.mainMenu = mainMenu
    state.current = mainMenu
    c.Movable.state = state

    # core game loop
    while True:
        # do the loop for the current state (passing in state)
        state.current.loop(state.screen)

        # show stuff on screen
        pygame.display.flip()

        #do loop at 60 fps
        clock.tick(60)
예제 #5
0
def menu_header():

    # Print Import Message Above
    duplicate_main_menu = menus.Menu("duplicate_removal",
                                     menus.DUPLICATE_MENU_LIST,
                                     menus.DUPLICATE_MENU_ROUTE)
    duplicate_main_menu.print_menu_message()
    duplicate_main_menu.display_shift_menu()
예제 #6
0
def comidas(v):
    n = len(v)
    for i in range(n):
        nom = input("Ingrese el nombre de la comida " + str(i) + ": ")
        tipo = int(input("Ingrese el tipo de la comida: "))
        clas = int(input("Ingrese la clase de la comida: "))
        tiem = round(float(input("Ingrese el tiempo de coccion(en min): ")), 2)
        pre = round(float(input("Ingrese el precio de la comida: ")), 2)
        v[i] = menus.Menu(tipo, nom, clas, tiem, pre)
        print()
예제 #7
0
def videoOptions():
    state = State()
    items = []

    fullint = 0
    if state.fullscreen != 0:
        fullint = 1
    fullscreenOption = m.MenuValues('Fullscreen', ['Off', 'On'], fullint)

    ratios = ['4x3', '16x9', '16x10']
    ratioint = ratios.index(state.ratio)
    ratioOption = m.MenuValues('Aspect Ratio', ratios, ratioint)

    def confirmOptions():
        if fullint != fullscreenOption.curval or ratioint != ratioOption.curval:

            # get fullscreen value
            setfull = state.fullscreen
            if fullscreenOption.curval == 0:
                setfull = 0
            elif fullscreenOption.curval == 1:
                setfull = pygame.FULLSCREEN

            # get aspect ratio value
            setsize = state.size
            if items[1].curval == 0:
                setsize = (1024, 768)
            elif items[1].curval == 1:
                setsize = (1280, 720)
            elif items[1].curval == 2:
                setsize = (1280, 800)

            # apply changes
            state.screen = pygame.display.set_mode(setsize, setfull)
            state.fullscreen = setfull
            if ratioint != ratioOption.curval and state.game != None:
                state.game.resize(setsize[0], setsize[1])

            state.size = (state.width, state.height) = setsize
            state.writeSettings()

        backToMainMenu()

    items.append(fullscreenOption)
    items.append(ratioOption)
    items.append(m.MenuItem('OK', confirmOptions))
    items.append(m.MenuCancel('Cancel', backToMainMenu))
    state.current = m.Menu(state, items)
예제 #8
0
def menu_header():
    # Print Main Cleanup Menu
    cleanup_main_menu = menus.Menu("cleanup", menus.CLEANUP_MENU_LIST,
                                   menus.CLEANUP_MENU_ROUTE)
    cleanup_main_menu.print_menu_message()
    cleanup_main_menu.display_shift_menu()
예제 #9
0
def menu_header():

    # Print Import Message Above
    import_menu = menus.Menu("file_in", menus.IMPORT_MENU_LIST, menus.IMPORT_MENU_ROUTE)
    import_menu.print_menu_message()
    import_menu.display_shift_menu()
예제 #10
0
def menu_header():
    # Print Main Compress Menu
    cleanup_main_menu = menus.Menu("compress", menus.COMPRESS_MENU_LIST,
                                   menus.COMPRESS_MENU_ROUTE)
    cleanup_main_menu.print_menu_message()
    cleanup_main_menu.display_shift_menu()
예제 #11
0
def menu_header():
    main_menu = menus.Menu("top", menus.TOP_MENU_LIST, menus.TOP_MENU_ROUTE)
    main_menu.print_menu_message()
    main_menu.display_shift_menu()
예제 #12
0
import menus


# Global Parameters
# Note you need to update WIDTH/HEIGHT in asteroids as well! (Although its not really used very much)
WIDTH, HEIGHT = RES = (1280, 720)
fps = 60

# Inititalize Pygame and create a Display
pg.init()
screen = pg.display.set_mode(RES)
pg.display.set_caption("ASTEROIDZ - CMPUT274 Final Project by Tharidu and Jehanzeb")
clock = pg.time.Clock()

# Menu buttons and Setup
menu = menus.Menu(screen)
menu.add_button(menus.ButtonSprite('New_Game', 0.5, 0.4, 600, 100, Path("./Assets/").glob("New_game*")))
menu.add_button(menus.ButtonSprite('Quit', 0.5, 0.6, 300, 90, Path("./Assets/").glob("Quit*")))

# Initializes the score_screen object and adds the apropriate buttons to the ButtonSprite
score_screen = menus.Menu(screen, bg_path="./assets/Score_screen.png")
score_screen.textBoxes.append(menus.Text("0", 0.48, 0.27, 65))
score_screen.add_button(menus.ButtonSprite('Back', 0.5, 0.5, 250, 80, Path("./Assets/").glob("Back*")))
score_display = menus.Text("", 0, 0.2, 20)

# Defines text to be rendered to the screen burring the game
asteroids_display = menus.Text("", 0, 0.3, 20)
level_display = menus.Text("Level: 1", 0, 0.3, 20)
fps_display = menus.Text("", 0.935, 0, 20)

# The Main loop is setup as a finite state machine, these are some of the variables it uses
예제 #13
0
def do(screen, songdata):

    onoff_opt = {
        ui.START: switch_onoff,
        ui.CONFIRM: switch_onoff,
        menus.CREATE: get_onoff,
        ui.LEFT: off_onoff,
        ui.RIGHT: on_onoff
    }
    offon_opt = {
        ui.START: switch_offon,
        ui.START: switch_offon,
        menus.CREATE: get_offon,
        ui.LEFT: off_offon,
        ui.RIGHT: on_offon
    }
    rotate_opt = {
        ui.START: switch_rotate,
        ui.CONFIRM: switch_rotate,
        ui.LEFT: switch_rotate_back,
        ui.RIGHT: switch_rotate,
        menus.CREATE: get_rotate
    }
    rotate_index_opt = {
        ui.START: switch_rotate_index,
        ui.CONFIRM: switch_rotate_index,
        ui.LEFT: switch_rotate_index_back,
        ui.RIGHT: switch_rotate_index,
        menus.CREATE: get_rotate_index
    }
    tuple_opt = {
        ui.START: switch_tuple,
        ui.CONFIRM: switch_tuple,
        ui.LEFT: switch_tuple_back,
        ui.RIGHT: switch_tuple,
        menus.CREATE: get_tuple
    }

    sprites = pygame.sprite.RenderUpdates()
    try:
        lines = file(os.path.join(pydance_path, "CREDITS")).read().split("\n")
        lines = [l.decode("utf-8") for l in lines]
        Credits([_("pydance %s") % VERSION] + lines).add(sprites)
    except:
        Credits([
            _("pydance %s") % VERSION,
            "http://icculus.org/pyddr",
            _("By Joe Wreschnig, Brendan Becker, & Pavel Krivitsky"),
            _("(Your CREDITS file is missing.)"),
        ]).add(sprites)

    m = ([
        _("Play Game"), {
            ui.START: wrap_ctr,
            ui.CONFIRM: wrap_ctr
        }, (GameSelect, songdata)
    ], [
        _("Map Keys"), {
            ui.START: wrap_ctr,
            ui.CONFIRM: wrap_ctr
        }, (pad.PadConfig, (screen, ))
    ], (_("Game Options"), [_("Autofail"), onoff_opt, (_("autofail"), )], [
        _("Assist Mode"), tuple_opt,
        (_("assist"), [(0, _("Off")), (1, _("Click")), (2, _("Full"))])
    ], [_("Announcer"), rotate_opt,
        ('djtheme', Announcer.themes())], (_("Themes ..."), [
            _("4 Panel"), rotate_opt,
            ("4p-theme", ThemeFile.list_themes("SINGLE"))
        ], [
            _("3 Panel"), rotate_opt,
            ("3p-theme", ThemeFile.list_themes("3PANEL"))
        ], [
            _("5 Panel"), rotate_opt,
            ("5p-theme", ThemeFile.list_themes("5PANEL"))
        ], [
            _("Large 6 Panel"), rotate_opt,
            ("6pl-theme", ThemeFile.list_themes("6PANEL"))
        ], [
            _("Small 6 Panel"), rotate_opt,
            ("6ps-theme", ThemeFile.list_themes("6VERSUS"))
        ], [
            _("Large 8 Panel"), rotate_opt,
            ("8pl-theme", ThemeFile.list_themes("8PANEL"))
        ], [
            _("Small 8 Panel"), rotate_opt,
            ("8ps-theme", ThemeFile.list_themes("8VERSUS"))
        ], [
            _("Large 9 Panel"), rotate_opt,
            ("9pl-theme", ThemeFile.list_themes("9PANEL"))
        ], [
            _("Small 9 Panel"), rotate_opt,
            ("9ps-theme", ThemeFile.list_themes("9VERSUS"))
        ], [
            _("Parapara"), rotate_opt,
            ("para-theme", ThemeFile.list_themes("PARAPARA"))
        ], [_("DMX"), rotate_opt,
            ("dmx-theme", ThemeFile.list_themes("DMX"))], [
                _("EZ2"), rotate_opt,
                ("ez2-theme", ThemeFile.list_themes("EZ2SINGLE"))
            ], [
                _("EZ2 Real"), rotate_opt,
                ("ez2real-theme", ThemeFile.list_themes("EZ2REAL"))
            ], [_("Back"), None, None]), [_("Back"), None, None]),
         (_("Graphic Options"), [_("Animation"), onoff_opt, ('animation', )], [
             _("Arrow Effects"), rotate_index_opt,
             ('explodestyle', (_('none'), _('rotate'), _('scale'),
                               _('rotate & scale')))
         ], [_("Backgrounds"), onoff_opt, ('showbackground', )], [
             _("Brightness"), tuple_opt,
             ('bgbrightness', [(32, _('very dark')), (64, _('dark')),
                               (127, _('normal')), (192, _('bright')),
                               (255, _('very bright'))])
         ], [_("Lyrics"), onoff_opt, ("showlyrics", )], [
             _("Lyrics Color"), rotate_opt,
             ("lyriccolor", [
                 _("pink/purple"),
                 _("purple/cyan"),
                 _("cyan/aqua"),
                 _("aqua/yellow"),
                 _("yellow/pink")
             ])
         ], [_("Back"), None, None]),
         (_("Interface Options"),
          [_("Save Input"), onoff_opt, ('saveinput', )], [
              _("Song Previews"),
              tuple_opt, ('previewmusic', [(0, "Off"), (1, "On"), (2, "Safe")])
          ], [_("Folders"), onoff_opt, ("folders", )],
          [_("Timer Display"), onoff_opt, ('fpsdisplay', )], [
              _("Song Info Screen"), tuple_opt,
              ('songinfoscreen',
               zip([0, 1, 2],
                   [_("Never"), _("Multi-song Only"),
                    _("Always")]))
          ], [
              _("Font (after restart)"), rotate_opt,
              ('fonttheme', FontTheme.themes())
          ], [
              _("Calibrate Latency"), {
                  ui.START: wrap_ctr,
                  ui.CONFIRM: wrap_ctr
              }, (calibrate.run, (screen, ))
          ], [_("Back"), None, None]))

    me = menus.Menu(_(""), m, screen, sprites)
    me.display()
예제 #14
0
def menu_header():
    # Menu Object
    share_menu = menus.Menu("share", menus.EMAIL_MENU_LIST, menus.EMAIL_MENU_ROUTE)
    share_menu.print_menu_message()
    share_menu.display_shift_menu()
예제 #15
0
def menu_header():

    # Print Import Message Above
    import_menu = menus.Menu("quit", menus.QUIT_LIST, menus.QUIT_ROUTE)
    import_menu.print_menu_message()
    import_menu.display_shift_menu()
예제 #16
0
파일: Py_ASR.py 프로젝트: Julexpuru/TFG_ASR
#area="muestras442"


def pred(model, sample):
    print("Procesando prediccion...")

    result = model.predict(np.expand_dims(sample, axis=0))
    if result[0] > 0.66:
        print("COMANDO ", result[0])
    else:
        print("NO COMANDO ", result[0])


print()
print("Herramienta de gestion del modelo ASR")
opt = ui.Menu()

while (not done):
    ### Nueva Muestra
    if (opt == 1):
        grab, fs, _ = rec.grabar(None)  ###Grabacion

        ###Datos de la muestra
        print("¿Es una muestra valida?(s/n)")
        vn = input()
        while not re.match("[sSnN]$", vn):
            print("Introduzca una respuesta valida (s/n)")
            vn = input()
        print("¿Es una muestra de hombre o mujer?(h/m)")
        hm = input()
        while not re.match("[hHmM]$", hm):
예제 #17
0
def menu_header():
    # Print Main Analysis Menu
    cleanup_main_menu = menus.Menu("analysis", menus.ANALYSIS_MENU_LIST, menus.ANALYSIS_MENU_ROUTE)
    cleanup_main_menu.print_menu_message()
    cleanup_main_menu.display_shift_menu()
예제 #18
0
def menu_header():
    # Menus object
    duplicate_main_menu = menus.Menu("graph", menus.GRAPH_LIST, menus.GRAPH_ROUTE)
    duplicate_main_menu.print_menu_message()
    duplicate_main_menu.display_shift_menu()