Quick actions

cmd+k|ctrl+k

Navigation

Languages

26-2 Музыкальный плеер

Snippet info

Language

Python

Visibility

public

Author

python100

Created

2025-07-28T20:42:16.609902Z

Updated

2025-07-28T20:42:16.609902Z

import os
import time
import pygame

pygame.init()
pygame.mixer.init()

# Загрузка аудиофайла
sound = pygame.mixer.Sound('audio.wav')
sound.play()
pygame.mixer.pause()  # Сразу ставим на паузу

def clear_screen():
    os.system("cls")

def play():
    pygame.mixer.unpause()
    clear_screen()
    print("🎵 Now Playing")
    print("══════════════")
    print("▶ Song Title")
    print("Press ENTER to pause")
    input()  # Ожидание нажатия клавиши
    pygame.mixer.pause()
    return  # возврат в главное меню

# Главный цикл программы
while True:
    clear_screen()
    print("🎵 MyPOD Music Player")
    print("═══════════════════")
    print("Press 1 to Play")
    print("Press 2 to Exit")
    print("Press anything else to refresh")
    
    choice = input("Enter your choice: ")
    
    if choice == "1":
        play()
    elif choice == "2":
        clear_screen()
        print("Thanks for using MyPOD!")
        pygame.mixer.quit()
        break
    else:
        continue  # Обновление меню
INFO