beeware / beeware/toga

NumberInput Widget does not work if instantiated with non-int step

Open
#4,306 3 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Python
Stars
5.4k
Forks
827
Avg merge
9h 45m
Merged PRs (30d)
58

Description

### Describe the bug

When a `toga.widgets.NumberInput` is instantiated and a step is given that is `float`, `str`, or `decimal.Decimal` the value property will always return `None`.

Tested on Linux Mint, Python 3.12.3, toga 0.5.3

### How to reproduce the bug

1. run example code with toga 0.5.3 installed
2. asserts will fail

### Minimum example code

```shell
import toga

number_input = toga.NumberInput(step=1.0, value=1)
assert number_input.value is not None
number_input.value = 2
assert number_input.value is not None
```

### Screenshots

_No response_

### Environment details

- Operating system and version: Linux Mint 22.3 - Cinnamon 64-bit
- Python version: 3.12.3
- Software versions:
- Toga: 0.5.3

### Logs

```

```

### Additional context

_No response_

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the example with toga.NumberInput using float, str, and decimal.Decimal step values, then locate the NumberInput implementation and its existing tests. Done means the value property is non-None both after construction and after assignment for these step types.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
desktop
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
62/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.