[Enhancement] Table rows navigation with keyboard PageUp and PageDown
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Anfängerfreundlichkeit
- 42/100
Rechercherichtung
Beginne in PySimpleGUI.py bei der Behandlung von select_rows in der update-Methode von Table und vergleiche sie anschließend mit DemoPrograms/Demo_Table_Element_Header_or_Cell_Clicks.py und der angehängten geänderten Demo. Überprüfe, wie sich der Fokus auf die anschließende Navigation mit Pfeiltasten auswirkt, und berücksichtige das angeforderte automatische Verhalten für PageUp/PageDown; die Demo sollte von der neu ausgewählten Zeile aus navigieren.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Type of Issue (Enhancement, Error, Bug, Question)
Enhancement
Operating System
Windows 10 Home 22H2
PySimpleGUI Port (tkinter, Qt, Wx, Web)
tkinter
Versions
Python version (sg.sys.version)
sg.sys.version
'3.10.6 (tags/v3.10.6:9c7b4bd, Aug 1 2022, 21:53:49) [MSC v.1932 64 bit (AMD64)]'
PySimpleGUI Version (sg.__version__)
4.60.4.123
GUI Version (tkinter (sg.tclversion_detailed), PySide2, WxPython, Remi)
sg.tclversion_detailed
8.6.12
Troubleshooting
These items may solve your problem. Please check those you've done by changing - [ ] to - [X]
- Searched main docs for your problem www.PySimpleGUI.org
- Looked for Demo Programs that are similar to your goal. It is recommend you use the Demo Browser! Demos.PySimpleGUI.org
- If not tkinter - looked for Demo Programs for specific port
- For non tkinter - Looked at readme for your specific port if not PySimpleGUI (Qt, WX, Remi)
- Run your program outside of your debugger (from a command line)
- Searched through Issues (open and closed) to see if already reported Issues.PySimpleGUI.org
- Have upgraded to the latest release of PySimpleGUI on PyPI (lastest official version)
- Tried using the PySimpleGUI.py file on GitHub. Your problem may have already been fixed but not released
Detailed Description
I would like to suggest automatic support for Table rows navigation by using the keyboard's PageUp and PageDown, just like the arrow up and arrow down keys works automatically.
I tried to add that kind of navigation in the demo table "Demo_Table_Element_Header_or_Cell_Clicks.py" and I am attaching my modified version in a file named "Demo_Table_Element_Header_or_Cell_Clicks_2.py".
(but I had to put it within a zip file since github did not accept attaching a .py file for this issue)
It does work visually i.e. when using the keyboard keys "page up" and "page down" the selected row seem to be changed as expected, when using the Table method "update" with the argument "select_rows" currently documented like this:
Type Name Meaning
List[int] select_rows List of rows to select as if user did
However, the new row does not really become selected, since when then trying to use the arrow up/down keys, the navigation does not start from there, but instead starts from the previously selected row (i.e. a row previously selected with a mouse click).
When trying to modify the Table method update (in the file "PySimpleGUI.py") it seems to work if also adding a call to the "focus" method as shown below:
(I added the two last lines)
if select_rows is not None:
rows_to_select = [i + 1 for i in select_rows]
self.TKTreeview.selection_set(rows_to_select)
if len(rows_to_select) == 1:
self.TKTreeview.focus(rows_to_select[0])
So if you would add that kind of call to the method "focus" then it would be possible to make the PageDown/PageUp work as in my attached demo file.
However, I think it should not be necessary to write that kind of code for every table, but instead I think it should work automatically just like the arrow up and arrow down works out of the box.
Maybe with a configuration option, but IMHO the default should be to automatically support navigation with PageUp/PageDown
Code To Duplicate
See the attached demo file which is a modified version of "Demo_Table_Element_Header_or_Cell_Clicks.py" and here are the most relevant modifications:
...
window["-TABLE-"].bind('<Next>' , "+-PageDown-")
window["-TABLE-"].bind('<Prior>' , "+-PageUp-")
...
elif event == '-TABLE-+-PageUp-':
currently_selected_row = values['-TABLE-'][0]
new_selected_row = max(0, currently_selected_row - number_of_rows_pageup_pagedown)
window['-TABLE-'].update(select_rows=[new_selected_row])
elif event == '-TABLE-+-PageDown-':
currently_selected_row = values['-TABLE-'][0]
new_selected_row = min(len(data)-1, currently_selected_row + number_of_rows_pageup_pagedown)
window['-TABLE-'].update(select_rows=[new_selected_row])
...
- Vorherrschende Sprache
- Python
- Sterne
- 13.8k
- Forks
- 1.8k
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beitragsleitfaden
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus PySimpleGUI/PySimpleGUI
-
Bug Done - Install Dev Build (see docs for how) Platform Specific Issue - Linux Port - TK
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
PySimpleGUI/PySimpleGUI#6904 · 15 Kommentare ·
-
Bug Demo Programs Done - Install Dev Build (see docs for how) Interoperability Port - TK workaround available
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
PySimpleGUI/PySimpleGUI#6900 · 1 Kommentar ·
-
Done - Install Dev Build (see docs for how) enhancement
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 62/100
PySimpleGUI/PySimpleGUI#3251 · 12 Kommentare ·
-
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 74/100
PySimpleGUI/PySimpleGUI#6906 · 1 Kommentar · 1 Reaktion ·
-
Bug Done - Install Dev Build (see docs for how) Port - TK
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 45/100
PySimpleGUI/PySimpleGUI#6902 · 1 Kommentar ·
Alle Issues in PySimpleGUI/PySimpleGUI
Ähnliche Issues
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
anthropics/skills#1811 · 1 Kommentar ·
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
speaches-ai/speaches#678 ·
-
bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
datalayer/mcp-compose#42 ·
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
conda-forge/spacy-feedstock#177 ·
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 70/100
UKGovernmentBEIS/inspect_evals#2523 ·