beeware / beeware/toga

Label's updated text won't be displayed on Android unless "refresh()" gets called explicitly

Open
#1,289 5 comments 0 reactions 0 assignees View on GitHub
android bug
Dominant language
Python
Stars
5.4k
Forks
827
Avg merge
15h 39m
Merged PRs (30d)
40

Description

**Describe the bug**

I create a `label = toga.Label()` whose text I then modify dynamically (based on user input). I do this via `label.text = '...'`. This works on Linux however the updated text won't show on Android. If I explicitly call `label.refresh()` then the updated text also shows on Android.

**To Reproduce**
Steps to reproduce the behavior:

1. Create a `text = toga.TextInput()` field and a `label = toga.Label()`. In the text input's `on_change` method, just copy the current value of the field to the label via `label.text = text.value`.
2. When entering text, it won't show on the label on Android unless `label.refresh()` is called explicitly.

**Expected behavior**

The updated text should show automatically.

**Environment:**
- Operating System: Ubuntu 20.04 / Android 10
- Python version: 3.9
- Software versions:

```
arrow==1.1.0
binaryornot==0.4.4
briefcase==0.3.5
certifi==2021.5.30
chardet==4.0.0
click==8.0.1
cookiecutter==1.7.3
gbulb==0.6.1
gitdb==4.0.7
GitPython==3.1.17
idna==2.10
Jinja2==2.11.3
jinja2-time==0.2.0
MarkupSafe==2.0.1
mypy-extensions==0.4.3
poyo==0.5.0
pycairo==1.20.1
PyGObject==3.40.1
python-dateutil==2.8.1
python-slugify==5.0.2
requests==2.25.1
six==1.16.0
smmap==4.0.0
text-unidecode==1.3
toga-core==0.3.0.dev27
toga-gtk==0.3.0.dev27
toml==0.10.2
travertino==0.1.3
typed-ast==1.4.1
typing-extensions==3.7.4.2
urllib3==1.26.5
```

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the issue with a toga.TextInput, toga.Label, and the TextInput on_change handler on Android. Trace the Label text assignment and compare it with the explicit refresh() path; done means updated label text appears automatically without calling refresh().

Written by the indexing model from the issue text.

Assessment

Tech stack
android, python
Domain
mobile
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.