Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

[Enhancement] Nativ support for getting and setting indices in e.g. Combo

Aperta
#6,631 0 commenti 1 reazione 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
25/100
Tipo di issue
Funzionalità
Chiarezza
Da chiarire
Stato di attività
Ferma
Stack tecnologico
python
Ambito
desktop

Direzione di ricerca

Inizia esaminando le API degli elementi Combo e Listbox, incluso l’accesso specifico di tkinter a TKCombo.current() descritto nell’issue. Confronta i metodi getter/setter dell’indice proposti con la rappresentazione alternativa di values e considera il port PySimpleGUIWeb; per completare sarebbe necessario un approccio deciso e retrocompatibile che funzioni in modo coerente tra i port rilevanti.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

enhancement Port - TK

Type of Issue (Enhancement, Error, Bug, Question)

Enhancement


Environment

Operating System

Windows version ('10', '10.0.19045', 'SP0', 'Multiprocessor Free')

PySimpleGUI Port (tkinter, Qt, Wx, Web)

tkinter


Versions

Python version (sg.sys.version)

3.11.6 (tags/v3.11.6:8b6ee5b, Oct 2 2023, 14:57:12) [MSC v.1935 64 bit (AMD64)]

PySimpleGUI Version (sg.__version__)

4.61.0.198

GUI Version (tkinter (sg.tclversion_detailed), PySide2, WxPython, Remi)

8.6.12


Your Experience In Months or Years (optional)

2 Years Python programming experience
10 Years Programming experience overall
Yes Have used another Python GUI Framework? (tkinter, Qt, etc) (yes/no is fine)


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
  • Upgraded to the latest official release of PySimpleGUI on PyPI
  • Tried using the PySimpleGUI.py file on GitHub. Your problem may have already been fixed but not released

Detailed Description

In the application I am currently working on, the user can choose between several options in a Combo. Depending on their choice, some data is displayed in a Listbox (different for each option in the Combo). Now the user can change the displayed data and the Listbox is updated accordingly.

All the data is saved internally in my application and displayed in a heavily formatted way. Therefore, I only need the indices of the Combo and the Listbox, which for the Combo I have to get through tkinter calls via window[combo_key].TKCombo.current(), and never their content.

Since one of my long-term goals for this application is to write a port for the PySimpleGUIWeb port, this problem contradicts the line "just replace import PySimpleGUI by PySimpleGUIWeb".

Also, everything that is stored in values[combo_key] is useless for me and only wastes memory.

There are two possible solutions for this problem which come to mind (not only for Combo but also for similar index-'supporting' objects):

  • Add methods to get and set the index. (Listbox has those methods for the selected lines which I use already.)
  • Add an option to the constructor s.t. not the selected item but the selected index is contained in values[element_key] (or both, i.e. as (index, value)). For backwards compatibility this can default to the old behaviour.

I far prefer the second solution, but the first one would already be really nice.

Lingua principale
Python
Stelle
13.8k
Fork
1.8k
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di PySimpleGUI/PySimpleGUI

Tutte le issue di PySimpleGUI/PySimpleGUI

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.