You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a use case where I put data from a database into the data table and i noticed that if cells contain a lot of text, switching focus to and from the data table is very slow.
In the following example, when tab is pressed, it takes ~2 seconds to switch focus from the Input to the DataTable. Scrolling is reasonably fast once focused.
fromtextual.appimportAppfromtextual.widgetsimportDataTable, InputNUM_LINES=100NUM_COLS=20NUM_ROWS=50COLS= [f"col {n}"forninrange(NUM_COLS)]
# Each cell contains a bunch of text with line breaksCELL="\n".join("much data wow"for_inrange(NUM_LINES))
ROW= [CELLfor_inrange(NUM_COLS)]
ROWS= [ROWfor_inrange(NUM_ROWS)]
classReproApp(App):
CSS="DataTable { height: 80%; }"defcompose(self):
yieldInput("Pressing TAB to switch focus is slow!")
dt=DataTable()
dt.add_columns(*COLS)
dt.add_rows(ROWS)
yielddtif__name__=="__main__":
app=ReproApp()
app.run()
Textual Diagnostics
Versions
Name
Value
Textual
0.72.0
Rich
13.7.1
Python
Name
Value
Version
3.12.3
Implementation
CPython
Compiler
GCC 14.0.1 20240411 (Red Hat 14.0.1-0)
Executable
/home/ihabunek/.virtualenvs/pgtui/bin/python
Operating System
Name
Value
System
Linux
Release
6.9.5-200.fc40.x86_64
Version
#1 SMP PREEMPT_DYNAMIC Sun Jun 16 15:47:09 UTC 2024
Terminal
Name
Value
Terminal Application
Kitty
TERM
xterm-kitty
COLORTERM
truecolor
FORCE_COLOR
Not set
NO_COLOR
Not set
Rich Console options
Name
Value
size
width=182, height=48
legacy_windows
False
min_width
1
max_width
182
is_terminal
False
encoding
utf-8
max_height
48
justify
None
overflow
None
no_wrap
False
highlight
None
markup
None
height
None
The text was updated successfully, but these errors were encountered:
@ihabunek Should be resolved in the next release (I'm guessing this week) for cases where cells contain text (str or rich.Text) content that spans multiple lines and only a portion of it is visible.
Load time of the DataTable should be much faster in those cases too, and focus/blur should be instant.
I have a use case where I put data from a database into the data table and i noticed that if cells contain a lot of text, switching focus to and from the data table is very slow.
In the following example, when
tab
is pressed, it takes ~2 seconds to switch focus from the Input to the DataTable. Scrolling is reasonably fast once focused.Textual Diagnostics
Versions
Python
Operating System
Terminal
Rich Console options
The text was updated successfully, but these errors were encountered: