Почему это?
Код: Выделить всё
import tkinter as tk
from tkinter import ttk
import simpleaudio as sa
from pygame import mixer
root = tk.Tk()
def main() -> None:
MainFrame()
root.mainloop()
class MainFrame():
"""Define the Main frame."""
def __init__(self):
button = ttk.Button(root, text='SimpleAudio', command=self.simple_audio)
button.grid(row=0, column=0)
button = ttk.Button(root, text='PyGame', command=self.pygame)
button.grid(row=1, column=0)
def simple_audio(self):
ping = sa.WaveObject.from_wave_file('ping.wav')
play = ping.play()
play.wait_done()
def pygame(self):
mixer.init()
mixer.Sound("ping.wav").play()
if __name__ == '__main__':
main()
Python: 3.12.3
simpleaudio: 1.0 4pygame: 2.5.2
Подробнее здесь: https://stackoverflow.com/questions/785 ... n-tkiinter