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