control label to display a clock?
#1
how can i get a control to display the current system time?

im building my own gui for my plugin and would like to add a clock.

Thanks
Reply
#2
Use "$INFO[System.Time]" as label.
My GitHub. My Add-ons:
Image
Reply
#3
like this?

self.clock = xbmcgui.ControlLabel(self.porcentaje(40, self.x), self.porcentaje(10, self.y), self.porcentaje(50, self.x), self.porcentaje(10, self.y), '', font='font30', alignment=2)
self.addControl(self.clock)
self.clock.setLabel($INFO[System.Time])

$INFO comes from which import?

where can i see what else does the $Info ?

Will this be a live clock? or do i have to set a timer or something to animate it?

Thanks
Reply
#4
$INFO will be parsed by the xbmc skinning engine, not Python. You can see all available InfoLabels here.

In your code you need to send it as string:
Code:
self.clock.setLabel('$INFO[System.Time]')
My GitHub. My Add-ons:
Image
Reply
#5
well it doesnt need the ' ' if its already a string.

if it needs convertion it would be more proper to do a

self.clock.setLabel(str($INFO[System.Time]))

no? im no python expert, but i do it all the time like this, would like to know if im wrong and why to learn two things today Wink

Thanks alot for your answers they have been very insightful!

Sorry i get it know, its not a variable, its a string that the skin will parse.

Sorry, got it late
Reply
#6
Yes.

So you got it working now?
My GitHub. My Add-ons:
Image
Reply
#7
yes thank you very much.

for future reference if anyone needs it, heres the complete code for the actual clock..

self.clock = xbmcgui.ControlLabel(xposition, yposition, xsize, ysize, '', font='font30', alignment=2) #text blank, alignment center
self.addControl(self.clock)
self.clock.setLabel('$INFO[System.Time]') #needs to be send as text, this is not a variable

thats it you get a clock like the one in xbmc. Thanks a lot sphere.

sorry to hiyack the thread do you happen to know how to catch the right click on the mouse without clicking a button to do a back command when right mouse click is detected anywhere the screen?
Reply

Logout Mark Read Team Forum Stats Members Help
control label to display a clock?0