TimeLabel()
Made a time label that updates ever 5 seconds to show the current time into the song.
This commit is contained in:
parent
d56f3b2d0a
commit
67676d2d62
|
@ -0,0 +1,27 @@
|
||||||
|
# Bryan Schumaker (10 / 18 / 2010)
|
||||||
|
import ocarina
|
||||||
|
|
||||||
|
gtk = ocarina.gtk
|
||||||
|
gobject = ocarina.gobject
|
||||||
|
|
||||||
|
#update = None
|
||||||
|
get_time = None
|
||||||
|
|
||||||
|
def set_fns():
|
||||||
|
#global update
|
||||||
|
global get_time
|
||||||
|
#update = ocarina.libsaria.music.get_progress
|
||||||
|
get_time = ocarina.libsaria.music.get_time
|
||||||
|
ocarina.libsaria.event.invite("POSTSTART", set_fns)
|
||||||
|
|
||||||
|
|
||||||
|
class TimeLabel(gtk.Label):
|
||||||
|
def __init__(self):
|
||||||
|
gtk.Label.__init__(self)
|
||||||
|
gobject.timeout_add(500, self.update)
|
||||||
|
self.show()
|
||||||
|
|
||||||
|
def update(self):
|
||||||
|
global get_time
|
||||||
|
self.set_text(get_time())
|
||||||
|
return True
|
Loading…
Reference in New Issue