Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AnchorLayout prevents child widgets from controlling their height #8669

Open
nanouasyn opened this issue Apr 3, 2024 · 0 comments
Open

AnchorLayout prevents child widgets from controlling their height #8669

nanouasyn opened this issue Apr 3, 2024 · 0 comments

Comments

@nanouasyn
Copy link
Contributor

Software Versions

  • Python: 3.11.3
  • OS: Linux Mint 19.1 Tessa
  • Kivy: 2.3.0

Describe the bug
When a widget that sets its height based on its width is placed in an AnchorLayout, the height of the widget does not change according to its width set by the AnchorLayout. AnchorLayout controls the height of such a widget, ignoring the outright prohibition (size_hint_y = None).

To Reproduce

Put the Image widget, which increases its height based on its width and image proportions, inside the AnchorLayout. Set size_hint_y to None to prevent AnchorLayout from controlling the height of the Image.

from kivy.lang import Builder
from kivy.app import runTouchApp

runTouchApp(Builder.load_string("""
AnchorLayout:
    anchor_y: 'center'
    Image:
        source: 'data/logo/kivy-icon-256.png'
        fit_mode: 'fill'
        size_hint_y: None
        height: self.width * self.texture_size[1] / self.texture_size[0]
"""))

It is expected that when changing the width of the AnchorLayout, the Image will change its height. But in fact, the height of the Image does not change:

error_video.mp4

Expected behavior

Image should change size, filling the window in width and keeping the proportions.

video.mp4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant