1

I have just been starting to use the Kivy framework, and am slightly confused on setting the window size based off the display size of the screen. For example if my display size is 200x100mm, how would I set that in Kivy?

I've looked at examples such as this one from SO, however I can't change seem to alter the size based off of the mm metric.

I have also tried converting mm to pixels, however that is also the wrong size on my screen, and I think it is a frowned upon technique from what I have read online.

import kivy
kivy.require('1.9.1')

from kivy.config import Config
Config.set('graphics', 'width', '200')
Config.set('graphics', 'height', '100')

I would like to add 200mm and 100mm in, however that brings up errors when attempting to build:

[CRITICAL] [Window      ] Unable to find any valuable Window provider at all!
sdl2 - ValueError: invalid literal for int() with base 10: '200mm'

How should I go about doing this in a correct manner?

Community
  • 1
  • 1
Rekovni
  • 6,319
  • 3
  • 39
  • 62

1 Answers1

2

I don't think that the size in mm counts, only the resolution of that screen.

So try to find out which resolutions will be in your target devices and tests them:

Config.set('graphics', 'width', '200')
Config.set('graphics', 'height', '100')

If just you want the full screen feature, Try this:

Window.fullscreen = 'auto' # you can also try True...
Yoav Glazner
  • 7,936
  • 1
  • 19
  • 36
  • The full screen feature would be handy, however for testing purposes I need to see it run on a different screen but with the same size as the final display screen? So I can't easily use this method...? – Rekovni Feb 14 '17 at 23:11
  • So does that mean if the resolution of my screen is 1024 x 250 I can just change the height and width to 1024 x 250? – Rekovni Feb 15 '17 at 08:50
  • 1
    for the shape, yes. to see the actual size read http://dallinjones.com/2008/07/how-to-convert-from-pixels-to-millimeters/ for more info on how to convert mm to pixels – Yoav Glazner Feb 15 '17 at 21:45