slider.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
3 # -*- Python -*-
4 
5 from Tkinter import *
6 #import thread
7 import dummy_threading
8 import time
9 
10 class SliderMulti(Frame):
11  def __init__(self, channels, master=None):
12  Frame.__init__(self, master)
13  self.init(channels)
14  self.pack()
15 
16 
17  def init(self, channels):
18  self._channels = channels
19  self.var = [] * len(self._channels)
20  self.scales = []
21 
22  i = 0
23  for channel in self._channels:
24  self.var.append(DoubleVar(0))
25  self.scales.append(
26  Scale(self, label=channel[0], variable=self.var[i],
27  to=channel[1], orient=VERTICAL))
28  self.scales[i]["from"] = channel[2]
29  self.scales[i]["resolution"] = channel[3]
30  self.scales[i]["length"] = channel[4]
31  self.scales[i].pack(side=LEFT)
32  i = i + 1
33 
34  def get(self):
35  val = []
36  for s in self.scales:
37  val.append(s.get())
38 
39  return val
40 
41  def set(self, value):
42  i = 0
43  for v in value:
44  self.scales[i].set(v)
45  i = i + 1
46  return
47 
48 
49 
50 
51 def test ():
52  channels = (("angle", 0, 360, 0.1, 200), ("velocity", -100, 100, 0.1, 200))
53  slider = SliderMulti(channels)
54  sth = dummy_threading.Thread(target=slider.mainloop, args=())
55  sth.start()
56 # thread.start_new_thread(slider.mainloop, ())
57 
58  while (1):
59  print slider.get()
60  time.sleep(0.5)
61 # slider.update()
62 
63 if __name__ == '__main__': test()
def __init__(self, channels, master=None)
Definition: slider.py:11
def append(dest, src)
Definition: NVUtil.py:386


openrtm_aist_python
Author(s): Shinji Kurihara
autogenerated on Mon Feb 28 2022 23:01:06