diff --git a/scripts/MusicPlayer/README.md b/scripts/MusicPlayer/README.md new file mode 100644 index 0000000..d8c7083 --- /dev/null +++ b/scripts/MusicPlayer/README.md @@ -0,0 +1,21 @@ +**Project** + +This is a basic music player project which is used to play music. + +**Usage** + +Once we run it, we get a GUI with 2 buttons. 'Select Songs' and 'o'. We select a song through the 'Select Songs' button and 'o' button is used to start or stop the song. +It supports Python3 and have used Pycharm for it. + +**Note** + +Audio files should be present in same folder as .py file is present. + +**Dependencies** + +Have to install library to get functional +- pip install pygame (in command line terminal) + +**Screenshot** + +![MusicPlayer](https://github.com/prathimacode-hub/Basic_Music_Player/blob/main/MusicPlayer.png) diff --git a/scripts/MusicPlayer/main.py b/scripts/MusicPlayer/main.py new file mode 100644 index 0000000..40bd055 --- /dev/null +++ b/scripts/MusicPlayer/main.py @@ -0,0 +1,28 @@ +from tkinter import * +import pygame +import os +from time import strftime +window = Tk() +pygame.mixer.init() +n=0 +def start_stop(): + global n + n=n+1 + if n == 1: + song_name=songs_listbox.get() + pygame.mixer.music.load(song_name) + pygame.mixer.music.play(0) + elif (n%2)==0: + pygame.mixer.music.pause() + elif (n%2)!=0: + pygame.mixer.music.unpause() +l1=Label(window,text="Prathima Music Player", font="times 18") +l1.grid(row=1, column=1) +b2=Button(window,text='o', command=start_stop) +b2.grid(row=4, column=1) +songs_list=os.listdir() +songs_listbox=StringVar(window) +songs_listbox.set("Select Songs") +menu=OptionMenu(window, songs_listbox, *songs_list) +menu.grid(row=4, column=4) +window.mainloop() \ No newline at end of file diff --git a/scripts/README.md b/scripts/README.md index 0a12b70..562935f 100644 --- a/scripts/README.md +++ b/scripts/README.md @@ -36,4 +36,7 @@ Your contribution should update this README with the following information, and - pdf_merger
A pdf merger to combine multiple PDFs into a single PDF.
[Anshul Hajare](https://github.com/AnshulH) +- MusicPlayer
+ A music player to select songs and play music.
+ [Prathima Kadari](https://github.com/prathimacode-hub)