im new to python and im getting use to tkinter but there no easy way to add sound i import pygame and create a hybrid code
import tkinter as tk
import pygame
pygame.init()
pygame.mixer.init()
button_sound = pygame.mixer.Sound("music/button_click.mp3")
main_window = tk.Tk()
#the main_window look
main_window.attributes("-fullscreen",True)
main_window.geometry("500x500")
main_window.title("project")
main_window.config(background="black")
#the close button
def press_button():
button_sound.play()
main_close = tk.Button(
main_window,
text="close",
command=press_button,
font=("arial",20,"bold"),
bg="black",
fg="white",
padx=98)
main_close.place(x=530,y=325)
i want to know ways to improve the code. this code is part of my python