Salome HOME
PN bug notation scientifique
[tools/eficas.git] / Tools / foztools / slider.py
1 # -*- coding: utf-8 -*-
2 #!/usr/local/bin/python
3 import Tkinter
4 from foztools import Slider
5
6 Tk=Tkinter
7
8 def main():
9     class Test:
10         def __init__(self):
11             win = Tk.Frame()
12             win.master.title("Slider Demo")
13             self.progress1=Slider(win, fillColor="red", labelColor="yellow",
14                                   value=0, width=200, height=15,
15                                   appearance="sunken", autoLabel="false",
16                                   labelFormat="%s",
17                                   labelText="Gary.Foster@corp.sun.com",
18                                   orientation="horizontal", bd=3)
19             self.progress2=Slider(win, fillColor="blue", labelColor="black",
20                                   background="white", value=250, width=50,
21                                   height=200, appearance="raised", max=250,
22                                   labelFormat="%d", orientation="vertical", bd=4)
23             self.progress1.frame.pack()
24             self.progress2.frame.pack()
25             win.pack()
26             self.progress1.frame.after(1000, self.update)
27             self.increment1=1
28             self.increment2=-1
29
30         def update(self, event=None):
31             bar1=self.progress1
32             bar2=self.progress2
33
34             bar1.value=bar1.value+self.increment1
35             if bar1.value > bar1.max:
36                 self.increment1=-1
37                 bar1.fillColor="green"
38                 bar1.labelColor="red"
39             if bar1.value < bar1.min:
40                 self.increment1=1
41                 bar1.fillColor="red"
42                 bar1.labelColor="yellow"
43             bar1.update()
44             bar1.frame.after(100, self.update)
45
46             bar2.value=bar2.value+self.increment2
47             if bar2.value > bar2.max:
48                 self.increment2=-1
49             if bar2.value < bar2.min:
50                 self.increment2=1
51             bar2.update()
52
53     t = Test()
54     Tk.mainloop()
55
56 if __name__=="__main__":
57     main()