Python Music Player Project | Make A Python Tkinter Music Player!

  Рет қаралды 43,843

ShawCode

ShawCode

Күн бұрын

In this video, I show you how to create a Python Music Player project using Tkinter! The project that we build in this video is a simple MP3 player using Python. The project uses Tkinter, which is a graphical user interface library that comes with python, and is perfect for this mp3 player python project. We are also using Pygame to play the audio, which is a separate library but can be installed easily with pip. If you would like to learn how to create a music player with python, be sure to watch this video! Be sure to subscribe so you don't miss out on easy to follow python projects.
IMAGES: www.mediafire....
SUBSCRIBE: kzbin.info?s...
Thanks for watching!

Пікірлер: 85
@xyzxyz6095
@xyzxyz6095 Жыл бұрын
This tutorial is awesome, your explanations, tries and errors but most of all the solutions and fixes are great content. Thank you for your generosity for sharing your programing skills with the rest of the world. Be Blessed and Successful in all your actions. Salutations from France.
@shivratanmarothiya2135
@shivratanmarothiya2135 8 ай бұрын
This tutorial is awesome, your explanations, tries and errors but most of all the solutions and fixes are great content. Thank you for your generosity for sharing your programing skills with the rest of the world. Be Blessed and Successful in all your actions. Salutations from India.
@DeevanshuBhagat
@DeevanshuBhagat 10 ай бұрын
You explained it better than my teacher 😅
@iAmMeAndYouAreYou
@iAmMeAndYouAreYou 8 ай бұрын
This works exactly as he shows. If it is not working for you i suggest very, very carefully look through every line of your code until you find the mistake you made.
@mafwbh
@mafwbh Ай бұрын
did it, thanks mate. insanely easily to understand.
@fahmidurarnob2470
@fahmidurarnob2470 2 жыл бұрын
This is was really interesting to do.
@ShawCode
@ShawCode 2 жыл бұрын
I'm glad you found it useful :D
@fahmidurarnob2470
@fahmidurarnob2470 2 жыл бұрын
@@ShawCode Please bring more project like this. it'll be very interesting and helpful for py newbies like me.
@hardrok6192
@hardrok6192 Жыл бұрын
This is really awesome. Thanks very much for sharing your talent. God bless.
@kaustubhchauhan460
@kaustubhchauhan460 Жыл бұрын
Bro thought he would upload the best tutorial and we wouldn't notice
@Leinad65
@Leinad65 2 жыл бұрын
He’s back 🥳🥳🥳🥳🥳🥳
@ShawCode
@ShawCode 2 жыл бұрын
I'll try uploading consistently from now on!
@stellanwae5050
@stellanwae5050 Жыл бұрын
You made it look so easy. Love it!
@codewithshreyash2009
@codewithshreyash2009 2 жыл бұрын
It was really nice video
@ShawCode
@ShawCode 2 жыл бұрын
Glad you found it useful!
@oluwadamilareadelusi53
@oluwadamilareadelusi53 Жыл бұрын
The code is working perfectly well and thank you
@abhisalunkhe6171
@abhisalunkhe6171 2 жыл бұрын
Helpful video
@ShawCode
@ShawCode 2 жыл бұрын
Thanks
@metrotrustme9333
@metrotrustme9333 5 ай бұрын
for some reason I keep getting an error that it cant get the photo file in the the code, im screwing somthing up somwhere.. But very good video man, very very well done. You make it look so easy haha I love your content.
@animeguy267
@animeguy267 Жыл бұрын
It works thanks shaw I wanna ask how can I add img in black background?
@EchoTheProot
@EchoTheProot Ай бұрын
When I did it, it worked, but every time I change songs, it playing only one song instead of the selected one
@sukuna_by
@sukuna_by Жыл бұрын
Very good
@JasperPloum
@JasperPloum Жыл бұрын
When I pause it and then hit play it plays from the beginning
@Profesoraronnax31
@Profesoraronnax31 2 жыл бұрын
You are the best dude ty for this videos
@ShawCode
@ShawCode 2 жыл бұрын
Thanks :D
@StitchesLovesRats
@StitchesLovesRats 5 ай бұрын
Any chance you could do one for Pimoroni Pirate Audio DAC HAT? So you could just do it with a basic Pi OS install? Pimoroni REALLY dropped the ball on that one.
@zakalutherjohns-pp1om
@zakalutherjohns-pp1om 8 ай бұрын
That was great bro would you teach me more
@andreus5113
@andreus5113 Жыл бұрын
well done! Even tho english is not my main lang i understood everything. Thank you!
@paulinaceze4935
@paulinaceze4935 2 жыл бұрын
Thank you!
@ShawCode
@ShawCode 2 жыл бұрын
You're welcome!
@michelematozza7801
@michelematozza7801 Жыл бұрын
doestn work, for me it says unresolved attribute reference directory for class tk and redeclared curren song defined above without usage
@christopherchastain5907
@christopherchastain5907 Жыл бұрын
On line 87 I get error: "play_music" not defined here is line 87 code: play_btn = Button(control_frame, image=play_btn_image, borderwidth=0, command=play_music) Here is my play music code section: def play_music(): global current_song, paused if not paused: pygame.mixer.music.load(os.path.join(root.directory, current_song)) pygame.mixer.music.play() else: pygame.mixer.music.unpause() paused = False Help would be much appreciated. Christopher
@xborgFF
@xborgFF 4 ай бұрын
Which editor do you used for the project
@shuncho7844
@shuncho7844 10 ай бұрын
for some reason when i run the code it says pygame.error:dsp:no such audio device, how do i fix it
@Sleepyhusan
@Sleepyhusan 26 күн бұрын
can someone help me? my song list doenst appear. theres nothing, no box, nothing. just the plain white window and the title.
@Sleepyhusan
@Sleepyhusan 26 күн бұрын
nvm i jst forgot to add the "()" on songlist.pack mb
@godswillnwabeke4784
@godswillnwabeke4784 Жыл бұрын
this so amazing, i have a little challenge on linking an API on my code
@michelematozza7801
@michelematozza7801 Жыл бұрын
i gwt an error on line 38 the line with the if not paused it says direcrtoryt isnt a thing in tk
@uchendukesnia5975
@uchendukesnia5975 Жыл бұрын
Nice video Everything worked but when I play the music I hear no sound of the played music
@chrisvermeer6729
@chrisvermeer6729 8 ай бұрын
Clicking on the next button results in stepping int the second song iso the next song...
@codewithshreyash2009
@codewithshreyash2009 2 жыл бұрын
Caleb why are you not posting videos now
@ShawCode
@ShawCode 2 жыл бұрын
Sorry, I've just been really busy recently with exams, etc. I will start posting soon!
@codewithshreyash2009
@codewithshreyash2009 2 жыл бұрын
No problem
@natorthumbu9139
@natorthumbu9139 5 ай бұрын
great project i had fun
@rachitsharmaofficial
@rachitsharmaofficial 5 ай бұрын
Hey bro , can you tell me how we connect the music player with pymysql database
@ganbeats2558
@ganbeats2558 Жыл бұрын
thanks brother it really helps me and as indian your "MENUBAR" acsent is something else that ramains in my mind forver😅
@shtick004
@shtick004 Жыл бұрын
Thank You for this video! It's going well, I just have one problem -- my play/pause/prev/next buttons are HUGE and won't fit on the root widget. I made them myself in Adobe Illustrator, and I'm willing to believe I exported them incorrectly. Any thoughts?
@skwizz
@skwizz Жыл бұрын
Just reduce their size into Adobe
@august_unreal
@august_unreal 4 ай бұрын
👌👌👌👌👌👌👌👌👌❤
@kraaydz7896
@kraaydz7896 Жыл бұрын
I have an error dude "pygame.error: Failed loading libmpg123-0.dll:" how should i fix this? Thank you!!
@Dycom4725
@Dycom4725 Жыл бұрын
How to add surround, shuffle, and time remaining for each song?
@kranthikranthi7865
@kranthikranthi7865 Жыл бұрын
Am also looking for this
@DDH-wd4ol
@DDH-wd4ol Жыл бұрын
Pls how do u get the module tkinter on the pc
@lekjkboy7069
@lekjkboy7069 Жыл бұрын
I want to ask anyone who knows what is happening with my "menubar" because it didn't show up. It is because I used the MacOs or Python version: menubar = Menu(root) #Menu() is a Tkinter class that represents a menu or menu bar. root.config(menu=menubar) organise_menu = Menu(menubar, tearoff=False) organise_menu.add_command(label="Select Folder", command=load_music) menubar.add_cascade(label="Organise", menu=organise_menu)
@gugaroxtutorials4413
@gugaroxtutorials4413 Жыл бұрын
pygame.error: ModPlug_Load failed ??
@PrimeMega-bd7wc
@PrimeMega-bd7wc Жыл бұрын
Wow.. this is so cool. Thanks for explaining everything
@ShawCode
@ShawCode Жыл бұрын
Glad you found the video useful!
@christopherchastain5907
@christopherchastain5907 Жыл бұрын
I get the following error when I bring up my program first part is my code and second is the error: from tkinter import * import pygame import os root = Tk() root.title('Music Player') root.geometry("500x300") pygame.mixer.init() songlist = listbox(root, bg="black", fg ="white", width=100, height=15) songlist.pack() root.mainloop() error: Traceback (most recent call last): File "C:\Users\chris\Desktop\PYTHON MUSIC PLAYER\main.py", line 11, in songlist = listbox(root, bg="black", fg ="white", width=100, height=15) NameError: name 'listbox' is not defined Thanks for your help.
@amrutanshusahoo9720
@amrutanshusahoo9720 Жыл бұрын
I think when ur trying to instantiate a listbox widget object ur using songlist = listbox(root, bg="black", fg ="white", width=100, height=15) but rather it should be songlist = Listbox(root, bg="black", fg ="white", width=100, height=15) Listbox is a widget class in Tkinter package, so the first character of 'listbox' should be an uppercase as in 'Listbox'
@amir1akhmetov
@amir1akhmetov Жыл бұрын
Thanks for such a great tutorial, it's really awesome
@beratkaya4036
@beratkaya4036 Жыл бұрын
App name????
@iumu-chan
@iumu-chan 4 ай бұрын
Python 3.9.6
@heshamhany8470
@heshamhany8470 Жыл бұрын
The Player isn't recognizing any .mp3 files.
@muhammedalihajji
@muhammedalihajji 9 ай бұрын
I found this video very helpful ❤️
@autarroy
@autarroy 2 жыл бұрын
Can you help me to code if one song finished playing then automatically must go to the next song. If you like I can send you the code
@undeadpresident
@undeadpresident 2 жыл бұрын
I tried doing this with the winsound and playsound modules and it's buggy.
@lailamira1115
@lailamira1115 Жыл бұрын
shout out sa bs infotech 402-c
@lakshyakumar4459
@lakshyakumar4459 Жыл бұрын
could somebody share the code ?
@_oskatech05
@_oskatech05 2 жыл бұрын
Nice video thanks for it 🔥🔥🔥🔥🔥
@ShawCode
@ShawCode 2 жыл бұрын
You're welcome :D
@Xarishher
@Xarishher Жыл бұрын
How did you learn to code so effortlessly?
@leeoleeo6937
@leeoleeo6937 7 ай бұрын
ok
@ALL_IN_ONE_YT_11
@ALL_IN_ONE_YT_11 Жыл бұрын
thanks man !!!
@phatho8585
@phatho8585 8 ай бұрын
Traceback (most recent call last): File "C:\Users\Admin\PycharmProjects\pygame\pygame.py", line 2, in import pygame File "C:\Users\Admin\PycharmProjects\pygame\pygame.py", line 8, in pygame.mixer.init() ^^^^^^^^^^^^ AttributeError: partially initialized module 'pygame' has no attribute 'mixer' (most likely due to a circular import) help me please
@_oskatech05
@_oskatech05 2 жыл бұрын
I just did a project very nice but I have a problem I did everything like you and an error pops up play_btn = Button(control_frame, image=play_btn_image, borderwidth=0, command=play_music) NameError: name 'play_music' is not defined
@ShawCode
@ShawCode 2 жыл бұрын
Please could you copy and paste your code for me to look at?
@_oskatech05
@_oskatech05 2 жыл бұрын
@@ShawCode from tkinter import filedialog from tkinter import * import pygame import os root = Tk() root.title('Music Player') root.geometry("500x300") pygame.mixer.init() menubar = Menu(root) root.config(menu=menubar) songs = [] current_song = "" paused = False def load_music(): global current_song root.directory = filedialog.askdirectory() for song in os.listdir(root.directory): name, ext = os.path.splitext(song) if ext == '.mp3': songs.append(song) for song in songs: songlist.insert("end", song) songlist.selection_set(0) current_song = songs[songlist.curselection()[0]] def play_music(): global current_song, paused if not paused: pygame.mixer.music.load(os.path.join(root.directory, current_song)) pygame.mixer.music.play() else: pygame.mixer.music.unpause() paused = False def pause_music(): global paused pygame.mixer.music.pause() paused = True def next_music(): global current_song, paused try: songlist.selection_clear(0, END) songlist.selection_set(song.index(current_song) + 1) current_song = songs[songlist.curselection()[0]] play_music() except: pass def prev_music(): global current_song, paused try: songlist.selection_clear(0, END) songlist.selection_set(songs.index(current_song) - 1) current_song = songs[songlist.curselection()[0]] play_music() except: pass organise_menu = Menu(menubar, tearoff=False) organise_menu.add_command(label='Select Folder', command=load_music) menubar.add_cascade(label='Organise', menu=organise_menu) songlist = Listbox(root, bg="black", fg="white", width=100, height=15) songlist.pack() play_btn_image = PhotoImage(file='play.png') pause_btn_image = PhotoImage(file='pause.png') next_btn_image = PhotoImage(file='next.png') prev_btn_image = PhotoImage(file='previous.png') control_frame = Frame(root) control_frame.pack() play_btn = Button(control_frame, image=play_btn_image, borderwidth=0, command=play_music) pause_btn = Button(control_frame, image=pause_btn_image, borderwidth=0, command=pause_music) next_btn = Button(control_frame, image=next_btn_image, borderwidth=0, command=next_music) prev_btn = Button(control_frame, image=prev_btn_image, borderwidth=0, command=prev_music) play_btn.grid(row=0, column=1, padx=7, pady=10) pause_btn.grid(row=0, column=2, padx=7, pady=10) next_btn.grid(row=0, column=3, padx=7, pady=10) prev_btn.grid(row=0, column=0, padx=7, pady=10) root.mainloop()
@_oskatech05
@_oskatech05 2 жыл бұрын
@@ShawCode pasted thanks for all the help
@ShawCode
@ShawCode 2 жыл бұрын
You have play_music(), pause_music(), next_music() and prev_music() functions indented underneath the load_music() function so that they are all in one function, but you need them to be separate functions - make sure that they aren't indented.
@_oskatech05
@_oskatech05 2 жыл бұрын
@@ShawCode ok thanks for help but they aren't separately ? pls ShawCode could you paste here your working code so i can compare them and improve mine i am a beginner in python
@NetherMystery
@NetherMystery 5 ай бұрын
File "C:\Users\Yaroslav\PycharmProject5\musicapp\main.py", line 36, in play_music pygame.mixer.music.load(os.path.join(root.directory, current_song)) ^^^^^^^^^^^^^^ File "C:\Users\Yaroslav\AppData\Local\Programs\Python\Python312\Lib\tkinter\__init__.py", line 2425, in __getattr__ return getattr(self.tk, attr) ^^^^^^^^^^^^^^^^^^^^^^ AttributeError: '_tkinter.tkapp' object has no attribute 'directory' HELP PLEASE
Create Stunning Python GUIs in 10 Minutes With Drag & Drop
11:38
Coding Is Fun
Рет қаралды 67 М.
Je peux le faire
00:13
Daniil le Russe
Рет қаралды 21 МЛН
АЗАРТНИК 4 |СЕЗОН 2 Серия
31:45
Inter Production
Рет қаралды 1 МЛН
C++ Developer Learns Python
9:26
PolyMars
Рет қаралды 2,7 МЛН
Can I Run Youtube Entirely From My Terminal? (No Browser)
15:31
How To Create Apps In Python Using Tkinter!
17:50
b001
Рет қаралды 55 М.
Modern Graphical User Interfaces in Python
11:12
NeuralNine
Рет қаралды 1,5 МЛН
Hacking Windows TrustedInstaller (GOD MODE)
31:07
John Hammond
Рет қаралды 628 М.
How to make advanced image recognition bots using python
15:01
Kian Brose
Рет қаралды 1,4 МЛН
How to Build Chatbot with Python & Rasa
2:28:05
Parwiz Forogh
Рет қаралды 52 М.
Creating Jarvis powered by OpenAI and Python | ChatGPT
18:40
CS Coach
Рет қаралды 908 М.
I use Drag and Drop to build modern Python Apps
14:08
Softlinks
Рет қаралды 72 М.