Answers for "tkinter OptionMenu(root, var, "sine", "noise")"

0

tkinter OptionMenu(root, var, "sine", "noise")

1  +#! /usr/bin/env python
            2  +
            3  +from Tkinter import *
            4  +from tkSnack import *
            5  +
            6  +root = Tkinter.Tk()
            7  +
            8  +initializeSnack(root)
            9  +"""AudioControllerSingleton().playLatency(100)"""
           10  +
           11  +def playbeep(freq):
           12  +   s.stop()
           13  +   filt.configure(freq)
           14  +   s.play(filter=filt)
           15  +
           16  +def beepC4():
           17  +   playbeep(261.6)
           18  +
           19  +def beepD4():
           20  +   playbeep(293.7)
           21  +
           22  +def beepE4():
           23  +   playbeep(329.7)
           24  +
           25  +def beepF4():
           26  +   playbeep(349.3)
           27  +
           28  +def beepG4():
           29  +   playbeep(392.1)
           30  +
           31  +def beepA4():
           32  +   playbeep(440.0)
           33  +
           34  +def beepB4():
           35  +   playbeep(493.9)
           36  +
           37  +def beepC5():
           38  +   playbeep(523.3)
           39  +
           40  +s = Sound()
           41  +
           42  +filt = Filter('generator', 440.0, 30000, 0.0, 'sine', 8000)
           43  +        
           44  +Button(root, text='C4', command=beepC4).pack(side='left')
           45  +Button(root, text='D4', command=beepD4).pack(side='left')
           46  +Button(root, text='E4', command=beepE4).pack(side='left')
           47  +Button(root, text='F4', command=beepF4).pack(side='left')
           48  +Button(root, text='G4', command=beepG4).pack(side='left')
           49  +Button(root, text='A4', command=beepA4).pack(side='left')
           50  +Button(root, text='B4', command=beepB4).pack(side='left')
           51  +Button(root, text='C5', command=beepC5).pack(side='left')
           52  +
           53  +root.mainloop()
Posted by: Guest on October-31-2020

Code answers related to "tkinter OptionMenu(root, var, "sine", "noise")"

Python Answers by Framework

Browse Popular Code Answers by Language