community icon indicating copy to clipboard operation
community copied to clipboard

mm to pixel conversion don't seems to work quite right

Open kalle opened this issue 12 years ago • 4 comments

When I try to draw a single circle with a diameter of 30 mm the actual circle on screen is ~25 mm. Kivy finds the correct screen size and the entire screen is filled with white.

I'm using Mac OS X 10.8.5 and is running kivy from the installer.

Here is my test program:

import kivy
kivy.require('1.0.8')

from kivy.app import App
from kivy.uix.widget import Widget
from kivy.graphics import Color, Ellipse
from kivy.clock import Clock
from kivy.metrics import mm as mm2px
from kivy.config import Config
Config.set('graphics', 'fullscreen', "auto")
from kivy.core.window import Window

Window.clearcolor = (1, 1, 1, 1)

class MyWidget(Widget):
    def draw(self, dt):
        self.canvas.clear()
        with self.canvas:
            Color(1, 1, 0)
            d = mm2px(30)
            Ellipse(pos=self.center, size=(d, d))

class MyApp(App):
    def build(self):
        w = MyWidget()
        Clock.schedule_once(w.draw)
        return w

if __name__ == '__main__':
    MyApp().run()

And here is how I run it together with its output

$ kivy testdpi.py

[INFO              ] Kivy v1.8.0
[INFO              ] [Logger      ] Record log in /Users/kalle/.kivy/logs/kivy_14-09-24_23.txt
[INFO              ] [Factory     ] 157 symbols loaded
[DEBUG             ] [Cache       ] register <kv.lang> with limit=None, timeout=Nones
[DEBUG             ] [Cache       ] register <kv.image> with limit=None, timeout=60s
[DEBUG             ] [Cache       ] register <kv.atlas> with limit=None, timeout=Nones
[INFO              ] [Image       ] Providers: img_imageio, img_tex, img_dds, img_pygame, img_gif (img_pil ignored)
[DEBUG             ] [Cache       ] register <kv.texture> with limit=1000, timeout=60s
[DEBUG             ] [Cache       ] register <kv.shader> with limit=1000, timeout=3600s
[DEBUG             ] [Window      ] Ignored <egl_rpi> (import error)
[INFO              ] [Window      ] Provider: pygame(['window_egl_rpi'] ignored)
[DEBUG             ] [WinPygame   ] Set window to fullscreen mode
[DEBUG             ] [Window      ] Display driver Quartz
[DEBUG             ] [Window      ] Actual window size: 2560x1440
[DEBUG             ] [Window      ] Actual color bits r8 g8 b8 a8
[DEBUG             ] [Window      ] Actual depth bits: 24
[DEBUG             ] [Window      ] Actual stencil bits: 8
[DEBUG             ] [Window      ] Actual multisampling samples: 2
[INFO              ] [GL          ] OpenGL version <2.1 NVIDIA-8.16.78 310.40.00.20f04>
[INFO              ] [GL          ] OpenGL vendor <NVIDIA Corporation>
[INFO              ] [GL          ] OpenGL renderer <NVIDIA GeForce GTX 660M OpenGL Engine>
[INFO              ] [GL          ] OpenGL parsed version: 2, 1
[INFO              ] [GL          ] Shading version <1.20>
[INFO              ] [GL          ] Texture max size <16384>
[INFO              ] [GL          ] Texture max units <16>
[DEBUG             ] [Shader      ] Fragment compiled successfully
[DEBUG             ] [Shader      ] Vertex compiled successfully
[DEBUG             ] [ImageImageIO] Load </Applications/Kivy.app/Contents/Resources/kivy/kivy/data/glsl/default.png>
[INFO              ] [GL          ] BGRA texture support is available
[INFO              ] [Window      ] virtual keyboard not allowed, single mode, not docked
[DEBUG             ] [App         ] Loading kv <./my.kv>
[DEBUG             ] [App         ] kv <./my.kv> not found
[INFO              ] [OSC         ] using <multiprocessing> for socket
[DEBUG             ] [Base        ] Create provider from mouse
[INFO              ] [Base        ] Start application main loop
[INFO              ] [Base        ] Leaving application in progress...

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

kalle avatar Sep 24 '14 18:09 kalle

Right, the mm does not care about DPI while it should.

tito avatar Sep 25 '14 09:09 tito

I am ImmovableOne and I am currently trying to solve this any suggestions are very welcome. Thank you

rastogiachyut avatar Jan 27 '15 13:01 rastogiachyut

putting this one on hold requires lot of research please ,everybody is welcome to try but if you are noob like me then maybe I can help. email id is = [email protected]

rastogiachyut avatar Jan 27 '15 19:01 rastogiachyut

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Oct 07 '17 12:10 stale[bot]