45 lines
1.2 KiB
Python
45 lines
1.2 KiB
Python
|
|
from Tkinter import *
|
|
|
|
import time
|
|
import json
|
|
|
|
class PrettyFloat(float):
|
|
def __repr__(self):
|
|
return '%.15g' % self
|
|
|
|
class App():
|
|
def __init__(self):
|
|
self.root = Tk()
|
|
|
|
self.label = Label(text="")
|
|
self.label.pack()
|
|
|
|
self.w1 = Scale(self.root, from_=1000, to=1)
|
|
self.w1.pack()
|
|
self.w2 = Scale(self.root, from_=1000, to=1)
|
|
self.w2.pack()
|
|
self.w3 = Scale(self.root, from_=1000, to=1)
|
|
self.w3.pack()
|
|
self.w4 = Scale(self.root, from_=1000, to=1)
|
|
self.w4.pack()
|
|
self.update_clock()
|
|
self.root.mainloop()
|
|
|
|
def update_clock(self):
|
|
|
|
velocity = float(self.w1.get())/1000
|
|
expressivity = float(self.w2.get())/1000
|
|
sensibility = float(self.w3.get())/1000
|
|
beauty = float(self.w4.get())/1000
|
|
data = {'velocity':PrettyFloat(velocity), 'expressivity':PrettyFloat(expressivity),'sensibility':PrettyFloat(sensibility),'beauty':PrettyFloat(beauty)}
|
|
print( data )
|
|
with open('/tmp/ws.json', 'w') as outfile:
|
|
json.dump(data, outfile)
|
|
now = time.strftime("%H:%M:%S")
|
|
self.label.configure(text=now)
|
|
self.root.after(1000, self.update_clock)
|
|
|
|
|
|
app=App()
|