Files
@ cce016abe31e
Branch filter:
Location: light9/bin/musictime - annotation
cce016abe31e
1.6 KiB
text/plain
sort of revive musictime. drop curvecalc time polling.
Ignore-this: 8f2e1f1624f86eb6231321a7fbaeea1f
Ignore-this: 8f2e1f1624f86eb6231321a7fbaeea1f
cce016abe31e 3c523c71da29 58bbf9f42457 58bbf9f42457 f066d6e874db 8d6f6d8a4719 cce016abe31e cce016abe31e 7772cc48e016 cce016abe31e 58bbf9f42457 cce016abe31e 7772cc48e016 58bbf9f42457 7772cc48e016 58bbf9f42457 58bbf9f42457 58bbf9f42457 58bbf9f42457 7772cc48e016 7772cc48e016 7772cc48e016 7772cc48e016 7772cc48e016 7772cc48e016 7772cc48e016 7772cc48e016 58bbf9f42457 7772cc48e016 58bbf9f42457 cce016abe31e f066d6e874db 7772cc48e016 58bbf9f42457 58bbf9f42457 58bbf9f42457 cce016abe31e cce016abe31e 58bbf9f42457 cce016abe31e cce016abe31e 7772cc48e016 58bbf9f42457 58bbf9f42457 58bbf9f42457 46d319974176 58bbf9f42457 7772cc48e016 58bbf9f42457 58bbf9f42457 58bbf9f42457 cce016abe31e cce016abe31e cce016abe31e | #!bin/python
import run_local # noqa
import light9.networking
import tkinter as tk
import time
import json
from twisted.internet import reactor, tksupport, task, defer
from light9.ascoltami.musictime_client import MusicTime
mt = MusicTime()
class MusicTimeTk(tk.Frame, MusicTime):
def __init__(self, master, url):
tk.Frame.__init__(self)
MusicTime.__init__(self, url)
self.timevar = tk.DoubleVar()
self.timelabel = tk.Label(self,
textvariable=self.timevar,
bd=2,
relief='raised',
width=10,
padx=2,
pady=2,
anchor='w')
self.timelabel.pack(expand=1, fill='both')
def print_time(evt, *args):
self.timevar.set(mt.getLatest().get('t', 0))
print(self.timevar.get(), evt.keysym)
self.timelabel.bind('<KeyPress>', print_time)
self.timelabel.bind('<1>', print_time)
self.timelabel.focus()
task.LoopingCall(self.update_time).start(.1)
def update_time(self):
t = self.getLatest().get('t', 0)
self.timevar.set(t)
if __name__ == "__main__":
from optparse import OptionParser
parser = OptionParser()
parser.add_option("-u", "--url", default=light9.networking.musicPlayer.url)
options, args = parser.parse_args()
root = tk.Tk()
root.title("Time")
MusicTimeTk(root, options.url).pack(expand=1, fill='both')
tksupport.install(root, ms=20)
reactor.run()
|