Clock Script - Python Font Size and Focus
#1
Quote:##################################################################
# basic onscreen clock
# coded by koshatul ([email protected])
##################################################################

import xbmc, xbmcgui, time
from string import *

updatedelay = 3 # second between updates


class koshclock(xbmcgui.windowdialog):
def (self):
xbmc.output("init screenclock : " + koshclocktime + "\n")
self.callerid = xbmcgui.controllabel(40, 25, 175, 96, koshclocktime, 'font13', '0xffffffff')
self.addcontrol(self.callerid)
xbmc.output("made callerid\n")

def settime(self):
xbmc.output("settime called : " + koshclocktime + "\n")
self.callerid.setlabel(koshclocktime)
xbmc.output("settime finished\n")

def onaction(self, action):
self.close()

koshclocktime = ""

screenclock = koshclock()
while 1:
xbmc.output("tick\n")
if xbmc.player().isplayingvideo():
koshclocktime = str(time.strftime("%h:%m"))
xbmc.output("set time : " + koshclocktime + "\n")
screenclock.show()
screenclock.settime()
xbmc.output("show screenclock\n")
else:
screenclock.close()
xbmc.output("hide screenclock\n")
sleep(updatedelay)

del screenclock

i'm trying to make a "clock" script to show aclock in the top corner (similar to what you see on tv shows in the morning)

two things are bugging me, is it possible to make a window that only displays when the video is fullscreen and doesn't receive actions/events ?

and is it possible to change the font size, or possibly create my own super large number only font ?

thanks,
kosh
Reply
#2
i would love to make my own font, because i could make it white with a black border, so it can be read even in dark scenes.

the event/action interception is annoying, when i'm watching a video i can play/pause/stop i can't use left/right to seek or anything fun

:thumbsup:
Reply
#3
look at poker timer ii, you can find it at xbmcscripts.com.

i used image files for the clock.

the timer uses 10 different controls for each place, but if you were'nt going to show seconds you could do it the way i did for changing blind amounts and things.

i felt updating every second was too much accessing the hard drive.
For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
Reply
#4
i wish there was a way to tell xbmc to cache image files. i have a tetris script in production that uses the same small block graphic dozens of times.
Reply
#5
koshclock files

this is what i have so far, but it still intercepts actions, is there a way to sorta
on action(self, action):
parent.onaction(action)
?
Reply
#6
(asteron @ feb. 03 2006,12:33 Wrote:i wish there was a way to tell xbmc to cache image files. i have a tetris script in production that uses the same small block graphic dozens of times.
i have no idea if this would work, but couldn't you make controlimages of each block on the screen with each colour, then just add/remove controls as that block is affected.

tmk, the image is loaded when you load controlimage ?

i'm lucky, i only really update the onscreen images once a minute.
plus i run the time update every 3 seconds instead of every second.

since i only need the "general" time not down to the second.

although it would pilage the memory to load those image like that
*shrug*



Reply

Logout Mark Read Team Forum Stats Members Help
Clock Script - Python Font Size and Focus0