Repository: kivy/kivy

Issue #6144: resizing the window halves image sizes on retina displays
Created: 2019-02-08T21:18:07Z
Versions

Python: 3.7.2
OS: macOS 10.14.3
Kivy: 1.11.0.dev0 (and before that, 1.10.1)
Kivy installation method: git clone (and before that, pip install)

Description
What are you trying to get done?
I'm trying to display an image correctly when resizing the window on a retina display.
what has happened?
The image is halved in height and width when resizing the window.
what went wrong, and what did you expect?
The image being half-sized (well, really, quarter-sized, by area), is wrong.  I expect it to scale correctly for the display.
other
The image scales just fine on a non-retina display.  With the code sample below, it scales fine when the window is moved on a retina display.
Without the image reload code, the image remains 1/4 size when moving or resizing the window.
With the image reload code, the image remains 1/4 size when resizing the window, but scales up as I expect/want when moving the window.
I'm confused what's going on - the reload from disk every 0.1s is gross, but I expect it at least to work consistently.  I don't understand why reloading the image makes it scale correctly when the window moves, but not when it's resized.
I've tried putting the image in a layout and calling do_layout, I've tried explicitly setting the image size with & without kivy.metrics.dp in the _resize func, and I've tried taking action on window resize, to no avail.
Code and Logs
class App(app.App):
    def build(self):
        clock.Clock.schedule_interval(self._resize, 0.1)
        self._image = image.Image(source=IMAGE_PATH, allow_stretch=False)
        return self._image

    def _resize(self, dt):
        self._image.reload()


if __name__ == "__main__":
    App().run()
[INFO   ] Kivy: v1.10.1
[INFO   ] Python: v3.7.2 (default, Jan 10 2019, 12:43:58) 
[Clang 10.0.0 (clang-1000.10.44.4)]
[INFO   ] Factory: 194 symbols loaded
[INFO   ] Image: Providers: img_tex, img_imageio, img_dds, img_sdl2, img_pil, img_gif (img_ffpyplayer ignored)
[INFO   ] Window: Provider: sdl2
[INFO   ] GL: Using the "OpenGL ES 2" graphics system
[INFO   ] GL: Backend used <gl>
[INFO   ] GL: OpenGL version <b'2.1 ATI-2.4.10'>
[INFO   ] GL: OpenGL vendor <b'ATI Technologies Inc.'>
[INFO   ] GL: OpenGL renderer <b'AMD Radeon Pro 555 OpenGL Engine'>
[INFO   ] GL: OpenGL parsed version: 2, 1
[INFO   ] GL: Shading version <b'1.20'>
[INFO   ] GL: Texture max size <16384>
[INFO   ] GL: Texture max units <16>
[INFO   ] Window: auto add sdl2 input provider
[INFO   ] Window: virtual keyboard not allowed, single mode, not docked
[INFO   ] GL: NPOT texture support is available
[INFO   ] Base: Start application main loop
[INFO   ] Base: Leaving application in progress...

Duplicate issue #3311: Doubling or halving of size when moving to or from retina display
Created: 2015-04-29T09:40:13Z
It seems like the dpi of the current monitor is obtained at startup and saved, and isn't obtained again.
I noticed if you move an app from a retina display onto an external monitor, the sizes of everything is doubled still and everything looks twice as big as it should. As well if the program is launched on a standard resolution monitor and is moved to a retina display, everything is drawn again at half the size.
I'm running on mac os 10.10.3 if that helps

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

Closing comment (2020-05-13T21:26:47Z): Duplicate of #6144.