import pygame.mixer from tkinter import * sounds = pygame.mixer sounds.init() def wait_finish(channel): while channel.get_busy(): pass def button_click(): s = sounds.Sound("chimes.wav") s.play() #wait_finish(s.play()) print("button click") app = Tk() app.title("Your tkinter application") app.geometry(‘450x100+200+100‘) b1 = Button(app,text = "Click me!",width = 10,command = button_click) #b1.pack(side = ‘bottom‘) b1.pack(padx = 100,pady = 40) app.mainloop()
时间: 2024-11-06 03:42:17