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

DetailedList showing empty rows #1920

Closed
alexcg1 opened this issue May 1, 2023 · 2 comments · Fixed by #1927
Closed

DetailedList showing empty rows #1920

alexcg1 opened this issue May 1, 2023 · 2 comments · Fixed by #1927
Labels
bug A crash or error in behavior.

Comments

@alexcg1
Copy link

alexcg1 commented May 1, 2023

Describe the bug

Using Toga for the first time, trying to add DetailedListBox to my window. Something shows up in the box that contains the DetailedListBox, but it just looks like a single empty list cell. on_select confirms that it's a list cell.

Steps to reproduce

Run this code:

import toga
from toga.style.pack import Pack

history_data = [
    {
        'icon': toga.Icon.DEFAULT_ICON,
        'title': 'Foo',
        'subtitle': 'Bar',
        'pk': 100,
    },
]


def build(app):
    history = toga.DetailedList(
        id='foo',
        data=history_data,
        on_select=selection_handler,
    )

    history_box = toga.Box()
    history_box.add(history)

    box = toga.Box(style=Pack(padding=(5, 5)))

    box.add(history_box)

    return box


def main():
    return toga.App('DetailedList test', 'foo.bar', startup=build)


def selection_handler(widget, row):
    print('Row {} of widget {} was selected'.format(row, widget))


if __name__ == '__main__':
    main().main_loop()

Expected behavior

A populated listbox shows up

Screenshots

image

Environment

  • Operating System: Manjaro Linux
  • Python version: 3.10
  • Software versions:
    • Briefcase:
    • Toga: 0.3.1
    • ...

Logs


Additional context

  • If I add other stuff to box, that stuff renders fine
  • No matter how many rows I add in list, always seems to render just one empty cell
@alexcg1 alexcg1 added the bug A crash or error in behavior. label May 1, 2023
@LunaMeadows
Copy link
Contributor

Looking into this, and looks like a temporary fix is setting a width for the detailed list manually makes it show the items in the list.

@alexcg1
Copy link
Author

alexcg1 commented May 2, 2023

Fantastic, thanks @LunaMeadows !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A crash or error in behavior.
Projects
None yet
2 participants