question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

.kv is not binding to updates in properties of elements of a dictionary

See original GitHub issue

If my app has a dictionary called dict, which say looks something like this :

dict = DictProperty({'k':Button()})

Then say in my .kv file I have

<Label>:
    text: app.dict['k'].text

then the labels text doesn’t get updated when the buttons text is updated.

If this is not a bug, I’m hoping it can be implemented for it to update when the button’s text changes.

Issue Analytics

  • State:closed
  • Created 10 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
ecerulmcommented, Jun 24, 2019

Nowadays, this will work also

text: (app.dict).get(‘k’).text

note: the parentheses around the property. This syntax allows for “unconventional” keys like .@id which won’t work with the dot notation. (e.g (app.dict).get('.@id') works while app.dict..@id won’t work)

0reactions
aleferna12commented, Dec 16, 2021

Nowadays, this will work also

text: (app.dict).get(‘k’).text

note: the parentheses around the property. This syntax allows for “unconventional” keys like .@id which won’t work with the dot notation. (e.g (app.dict).get('.@id') works while app.dict..@id won’t work)

Is this syntax documented anywhere? I would like to understand better how the bindables are created from KV files

Read more comments on GitHub >

github_iconTop Results From Across the Web

Kv language — Kivy 2.1.0 documentation
The KV language, sometimes called kvlang or the kivy language, allows you to create your widget tree in a declarative way and to...
Read more >
Kivy: Get widgets ids and accessing widgets by unique property
The id works like a python dict key id:Widget but only if accessed through the dictionary( ids ). I think kv parser just...
Read more >
KV · Cloudflare Workers docs
Documentation for Cloudflare Workers, a serverless execution environment that allows you to create entirely new applications or augment ...
Read more >
Python Dictionary update() method - GeeksforGeeks
Returns: It doesn't return any value but updates the Dictionary with elements from a dictionary object or an iterable object of key/value pairs....
Read more >
kivy checkbox example - El Primer Grande
Syntax: dict.update([other]) Parameters: Takes another dictionary or an ... a new window will appear every kv file, e.g Kivy properties bind: dict.update ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found