Any Advice on Kivy for HD screens?

370 views
Skip to first unread message

T500

unread,
Oct 31, 2012, 8:11:05 PM10/31/12
to kivy-...@googlegroups.com
I've been playing with Kivy for almost a few months now and I'm really starting to get along with it and enjoying it. Thanks Guys.

My mind is now turning to making my project list into real world apps when the Nexus10 with its Hi-res screen turns up on the scene. The variation in screen resolution in the Android tablets ranging 1024x800 to 2560x1600 is starting me thinking my approach to widget and text sizes. I would imagine ipad users with the "Retina" display of 2048x1536 would be experiencing the simliar problems?

Does anyone have a simplified approach in the KV file to working with DPI to keep apps proportional as opposed to pixels or size_hints?

T500

unread,
Oct 31, 2012, 10:50:51 PM10/31/12
to kivy-...@googlegroups.com
Doh! Before anyone falls of there chair laughing or trips and falls over to answer this post, I just found in the 1.4.1 release notes....

" - (experimental) New DPI notation for NumericProperty. By default, 
    all the value have no meaning, but if you give a position, size, 
    font_size, it have a meaning: we ask you a value in pixels. 
    Now you can do things like: 

        # default notation 
        self.font_size = '10pt' 
        self.height = '44pt' 
        # alternative notation 
        self.font_size = (10, 'pt') 
        self.height = (44, 'pt') 

    We hope that will be a start for doing pixel-independent UI.  "

...thanks Mathieu, Akshay, Gabriel and Thomas. If anyone has any ideas, perls of wisdom, tips, hints or suggestions on this topic I would luv to hear them?

Mathieu Virbel

unread,
Oct 31, 2012, 11:17:31 PM10/31/12
to kivy-...@googlegroups.com
A fast answer before going to bed.

Don't use pt. pt was just an introduction to DPI, but it appears that
the problem is more complex. I'm introducing dp/sp notation, same as
android.

My experiments today showed that using pt for fontsize is not good:
having the exact fontsize on both desktop and mobile doesn't look good,
because you expect to have it smaller on the mobile. Try with the 1.4.1,
put some text, do a whole helol world ui, you'll see.

dp/sp notation will resolve it, and the calculation will be much simpler:
px = dp * density, density is 1 for 160dpi screen on android, and 1 for
96 dpi on desktop.

The current work is available on the fixes-dpi branch, checkout, make
force, and try the showcase example with:

- normal: python examples/demo/showcase/main.py
- simulate the rendering on a phone (htc one x, 320dpi):
KIVY_DPI_DENSITY=2 python examples/demo/showcase/main.py --size 1280x720
- simulate the rendering on a phone (motorola droid x, 240dpi):
KIVY_DPI_DENSITY=1.5 python examples/demo/showcase/main.py --size 854x480

Type F1, and check the Settings.

It's a work in progress, done during this day. We need test and fixes
all the widgets with the new notation. I want to push the change in
master as soon as possible, and will annouce it before the release,
because i've removed the hack for px/fontsize.

Good night,

Mathieu


Le 01/11/2012 03:50, T500 a �crit :
> --
>
>

T500

unread,
Nov 1, 2012, 10:41:46 AM11/1/12
to kivy-...@googlegroups.com
Thanks very much for that info Mathieu. Honestly it would have kept until the morning. 

Its greatly appreciated, as a newbie I have a bad habit of approaching problems from the wrong angle. I thought it would be an interesting point of discussion as screen size and densities are rapidly advancing. I have yet to achieve getting kivy to read an androids config preference for font sizes as a point of reference. ie; the res folder actually being used by the system to base a layout in kivy upon. At least I think this is my best guess approach at this time. 


I shall tinker around some more with res/dpi sensitive KV files. Screenmanager comes in real handy here.

Thanks again for effort on this awesome framework, sleep well.
Le 01/11/2012 03:50, T500 a �crit :
Reply all
Reply to author
Forward
0 new messages