File: mixplay.py

package info (click to toggle)
snack 2.2.10.20090624%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 3,868 kB
  • sloc: ansic: 32,602; sh: 8,558; tcl: 1,086; python: 761; makefile: 578
file content (61 lines) | stat: -rwxr-xr-x 1,395 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#! /usr/bin/env python

import sys
if sys.version_info[0] == 2:
    from Tkinter import *
else:
    from tkinter import *

from tkSnack import *

root = Tkinter.Tk()

initializeSnack(root)

snd1 = Sound()
snd2 = Sound()

map1 = Filter('map', 1.0)
map2 = Filter('map', 1.0)

def play():
   snd1.play(filter=map1)
   snd2.play(filter=map2)

def stop():
   snd1.stop()
   snd2.stop()

def config(arg):
   map1.configure(scale1.get())
   map2.configure(scale2.get())
                                                                           
def load1():
   filename = root.tk.call('eval', 'snack::getOpenFile')
   snd1.config(file=filename)

def load2():
   filename = root.tk.call('eval', 'snack::getOpenFile')
   snd2.config(file=filename)
         
                                                              
f = Frame(root)
f.pack()

scale1 = Scale(f, from_=1.0, to=0, resolution=0.01, label="sound 1", command=config)
scale1.pack(side='left')

scale2 = Scale(f, from_=1.0, to=0, resolution=0.01, label="sound 2", command=config)
scale2.pack(side='left')

scale1.set(1.0)
scale2.set(1.0)

fb = Frame(root)
fb.pack(side='bottom')
Button(fb, text='load 1', command=load1).pack(side='left')
Button(fb, text='load 2', command=load2).pack(side='left')
Button(fb, bitmap='snackPlay', command=play).pack(side='left')
Button(fb, bitmap='snackStop', command=stop).pack(side='left')

root.mainloop()