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

[Enhancement] Yield the "right click menu" event before the "cell clicked" event when right_click_selects=True

Aperta
#6,637 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
35/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
python
Ambito
desktop

Direzione di ricerca

Inizia con la riproduzione Python fornita e traccia la gestione di right_click_menu, right_click_selects e enable_click_events dell’elemento Table. Verifica la sequenza di eventi prodotta dall’esempio, quindi assicurati che l’evento del menu contestuale venga emesso prima dell’evento di clic sulla cella e conferma il comportamento con la riproduzione.

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.3 (tags/v3.11.3:f3909b8, Apr 4 2023, 23:49:59) [MSC v.1934 64 bit (AMD64)]

PySimpleGUI Version (sg.__version__)

4.60.5

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

8.6.12


Your Experience In Months or Years (optional)

Years Python programming experience
Years Programming experience overall
No 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

When using the right_click_menu options with the Table element, and right_click_selects=True, the event for the click happens before the event for the right click. This is counterintuitive because the right click is the primary action, so it should be emitted first.

I also can't figure out if there's a way to get the cell that was right clicked, though I can work around that.

Code To Duplicate
import PySimpleGUI as sg

menu = ["", ["Option 1", "Option 2"]]
table = sg.Table(
    values=[[1.0, "foo"], [2.0, "bar"]],
    headings=["Reading", "Name"],
    right_click_menu=menu,
    enable_click_events=True
)

layout = [[table]]

window = sg.Window(layout=layout, title="Right Click Menu Bug for Table")

while True:
    event, values = window.read()

    if event in [sg.WIN_CLOSED]:
        break

    print(event, values[event])


Screenshot, Sketch, or Drawing
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.