import pygame from pygame.locals import * import tkinter as tk BLACK = (0,0,0) RED = (255,0,0) GREEN = (0,255,0) BLUE = (0,0,255) WHITE = (255,255,255) def Play(): pygame.mixer.music.load("InsertBackgroundMusic.wav") pygame.mixer.music.play() def Pause(): pygame.mixer.music.pause() def Unpause(): pygame.mixer.music.unpause() def Sound(): sound_effect.play() pygame.init() sound_effect = pygame.mixer.Sound("SoundEffect.wav") root = tk.Tk() root.geometry("180x200") myframe = tk.Frame(root) myframe.pack() myLabel = tk.Label(myframe, text="Pygame Mixer") myLabel.pack() button1 = tk.Button(myframe, text="Play", command=Play, width=15) button1.pack(pady=5) button2 = tk.Button(myframe, text="Sound", command=Sound, width=15) button2.pack(pady=5) button3 = tk.Button(myframe, text="Unpause", command=Unpause, width=15) button3.pack(pady=5) button4 = tk.Button(myframe, text="Pause", command=Pause, width=15) button4.pack(pady=5) root.mainloop()