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

Fix AttributeError on segmented button created in declarative python #1754

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

alpianon
Copy link

Description of the problem

See #1735

Describe the algorithm of actions that leads to the problem

In segmentedbutton.kv, some code tries to access a MDSegmentedButtonIcon object parent's parent object without first checking if the MDSegmentedButtonIcon object actually has a parent's parent

Reproducing the problem

See #1735

Screenshots of the problem

See #1735

Description of Changes

In segmentedbutton.kv, we need to check if the MDSegmentButtonIcon object actually has a parent.parent before checking container's parent _label, otherwise you may get the following error: AttributeError: 'NoneType' object has no attribute 'parent'

Screenshots of the solution to the problem

Now the example code in #1735 works:

immagine

Code for testing new changes

The same example code found in #1735

@alpianon alpianon force-pushed the alpianon-patch-segmentedbutton branch from 3677f02 to 2adfc0d Compare December 13, 2024 11:06
In segmentedbutton.kv, we need to check if the MDSegmentButtonIcon
object actually has a parent.parent before checking container's parent
_label, otherwise you may get the following error: AttributeError:
'NoneType' object has no attribute 'parent'

Fix kivymd#1735

Signed-off-by: Alberto Pianon <[email protected]>
@alpianon alpianon force-pushed the alpianon-patch-segmentedbutton branch from 2adfc0d to 9333959 Compare December 13, 2024 11:07
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

Successfully merging this pull request may close these issues.

1 participant