zauberzeug / nicegui

Create web-based user interfaces with Python. The nice way.
https://nicegui.io
MIT License
9.79k stars 580 forks source link

In MAC, after the GUI mode is displayed once, it will not be displayed when it is run again #1492

Closed yxlwfds closed 1 year ago

yxlwfds commented 1 year ago

Description

在MAC中, GUI模式显示了一次后, 再次运行就不显示了 (translated: In MAC, after the GUI mode is displayed once, it will not be displayed when it is run again)

from nicegui import ui

grid = ui.aggrid({
    'defaultColDef': {'flex': 1},
    'columnDefs': [
        {'headerName': 'Name', 'field': 'name'},
        {'headerName': 'Age', 'field': 'age'},
        {'headerName': 'Parent', 'field': 'parent', 'hide': True},
    ],
    'rowData': [
        {'name': 'Alice', 'age': 18, 'parent': 'David'},
        {'name': 'Bob', 'age': 21, 'parent': 'Eve'},
        {'name': 'Carol', 'age': 42, 'parent': 'Frank'},
    ],
    'rowSelection': 'multiple',
}).classes('max-h-40')

def update():
    grid.options['rowData'][0]['age'] += 1
    grid.update()

ui.button('Update', on_click=update)
ui.button('Select all', on_click=lambda: grid.call_api_method('selectAll'))
# ui.button('Show parent', on_click=lambda: grid.call_column_api_method('setColumnVisible', 'parent', True))

ui.run(native=True, window_size=(800, 600))
yxlwfds commented 1 year ago

换成 ui.run(native=True, window_size=(800, 600), uvicorn_logging_level='debug', reload=True, uvicorn_reload_dirs='.') 后可以运行并显示了 (translation: it can be run and displayed)

rodja commented 1 year ago

I tried to add translation to your messages but it's quite hard to understand. Let me try to rephrase what I have inferred:

You can run the code above which displays the table as expected. But the table disappears after changing the code (which triggers a reload). If you add uvicorn logging and reload dirs it works as expected even after reloading.

Is my summary correct?

yxlwfds commented 1 year ago

貌似发现问题了,是GUI运行在PYCHARM后面了,所以看不到.

Translation: "It seems that the problem is found, the GUI is running behind PYCHARM, so I can't see it."

falkoschindler commented 1 year ago

@yxlwfds Please use English language when posting to this repository, e.g. by using an online translation tool. Otherwise we need to do the translation ourselves and can't be sure the result is what you meant.

Regarding your last comment: Is the issue resolved? Can we close it?

falkoschindler commented 1 year ago

I'll close this issue due to inactivity. Feel free to open a new ticket with a clear problem statement (in English language) in case the issue persists.