This is my code which i am using..this whole code is in a function
mixing = pygame.mixer.music.play
with mixing(1) as song_is_playing:
print(song_is_playing)
def stop_btn_pressed():
stop()
song_root.destroy()
song_root = Tk()
song_root.title("Enter Password")
song_root.geometry("350x200")
song_root.config(bg="ghostwhite")
song_frame1 = Frame(song_root, pady=40, bg="ghostwhite")
song_frame1.pack()
song_pause_btn = Button(song_frame1, border=2, text="Pause",
command=pause)
song_pause_btn.pack()
song_btn_stop = Button(song_frame1, text="stop",
command=stop_btn_pressed, padx=55, bg="ghostwhite", activebackground="lightcoral")
song_btn_stop.pack()
song_btn_unpause = Button(song_frame1, text="Unpause", command=unpause, padx=55,
bg="ghostwhite", activebackground="lightcoral")
song_btn_unpause.pack()
song_root.mainloop()
And getting a error
Traceback (most recent call last):
File "C:/Users/user/PycharmProjects/Jarvis/testing.py", line 60, in
<module>
play_songs(songs)
File "C:/Users/user/PycharmProjects/Jarvis/testing.py", line 36, in
play_songs
with mixing(1) as song_is_playing:
AttributeError: __enter__
help me solving this error...Why i am getting this error?