Screen width
#1
Hi all,

I want to display, from the addon I'm writing, a picture with width 100% of the screen.
When I get the screen width with window.getWidth() it gives me 1920 (wich is correct as displayed in system info), but it seems that kodi uses a virtual resolution of 1280x720 as in the allegated screeshot.
How can I get in the code the actual screen width to use?

Following the relevant code:

Code:
bar1 = xbmcgui.ControlImage(0, 100, 1000, 15, os.path.join(__resources__, 'bar.png'))
bar2 = xbmcgui.ControlImage(0, 150, 1200, 15, os.path.join(__resources__, 'bar.png'))
bar3 = xbmcgui.ControlImage(0, 200, window.getWidth(), 15, os.path.join(__resources__, 'bar.png'))

window.addControls([bar1, bar2, bar3])

bar.png is a test image 1920x50.

Image
Image
Reply
#2
Following with Interest. I csn tell you that on my winbox it uses 1920.
Reply
#3
New Window and WindowDialog instances always have 1280x720 coordinate grid resolution regardless of your actual display resolution or the current skin virtual resolution (unless you are attaching Controls to existing windows). You can create an Image control with 1280x720 size but you have to account for possible display overscan.
Reply
#4
First of all thank you for your answer, but I'm confused... I'm attaching the xbmcgui.ControlImage to xbmcgui.Window(10000), what do you mean with "New Window and WindowDialog instances"?
The code I posted on pastebin is just a test, the real goal of my addon is to display a text ticker on the WINDOW_FULLSCREEN_VIDEO window (12005) can I assume that the (virtual) screen resolution will always be 1280x720?
Can you point me to a page in the Kodi documentation where is explaned this beaviour?
Reply
#5
Confluence is a 720p skin, it's coded in 1280x720.
if you want to add controls, you have to take the skin dimensions into account, not the screen dimensions.
Do not PM or e-mail Team-Kodi members directly asking for support.
Always read the Forum rules, Kodi online-manual, FAQ, Help and Search the forum before posting.
Reply
#6
@ronie Oh finally I got it thank you!

How do I query the skin to get the virtual resolution of the screen?
Reply
#7
(2016-04-12, 10:41)maxxam Wrote: First of all thank you for your answer, but I'm confused... I'm attaching the xbmcgui.ControlImage to xbmcgui.Window(10000), what do you mean with "New Window and WindowDialog instances"?

I mean literally new instances. With Window class you can either attach your controls to an existing window using Window ID (which you are doing obviously), or to create a brand new instance with the default Window constructor (with no parameters). If you are working with existing windows, then, in theory, you need to account for its actual resolution, but in practice there is no way to do it.

Quote:How do I query the skin to get the virtual resolution of the screen?

Simple answer: you cannot. Kodi Python API does not provide facilities to query a skin coordinate grid resolution, and that's a big problem if you want to work with existing windows from Python. In theory, you can use a dirty hack to peek into skin files, but it may not work with every skin, and one skin can actually have several resolutions and, again, there is no way to know which resolution is active now.
Reply

Logout Mark Read Team Forum Stats Members Help
Screen width0