Hacktoberfest 2026 : les issues que les mainteneurs ont marquées pour octobre, ouvertes et accessibles aux débutants. Parcourir les issues Hacktoberfest

Bug: Error dialog when programatically updating PySimpleGUIQt Checkbox

Ouverte
#6,764 5 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

Évaluation

Difficulté
3/5
Temps estimé
1-2 jours
Accessibilité débutants
42/100
Type d'issue
Bug
Clarté
Plutôt claire
Activité
À l'abandon
Stack technique
python
Domaine
desktop

Piste de recherche

Reproduisez le problème avec l’exemple fourni, puis inspectez PySimpleGUIQt.py autour de la ligne 562 ainsi que le chemin de mise à jour de Checkbox. Vérifiez comment l’état de Window.read et l’état de finalize sont détectés lorsque window[tr].update est appelé. La tâche est terminée lorsque la sélection ou la désélection des deux cases à cocher n’ouvre plus de boîtes de dialogue d’avertissement, tout en conservant les valeurs demandées.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

Bug Port - Qt
Type of Issue (Enhancement, Error, Bug, Question)

Bug


Operating System

Windows 10 and Windows 11

PySimpleGUI Port (tkinter, Qt, Wx, Web)

Qt


Versions

Python version (sg.sys.version)

'3.12.3 (tags/v3.12.3:f6650f9, Apr 9 2024, 14:05:25) [MSC v.1938 64 bit (AMD64)]'

PySimpleGUI Version (sg.__version__)

'5.0.0'
PySimpleGUI 5.0.4
PySimpleGUIQt 5.0.0

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

PySide6 6.7.0
PySide6_Addons 6.7.0
PySide6_Essentials 6.7.0

Priority Support Code (Commercial Users)

Your Experience In Months or Years (optional)

Years Python programming experience:
1

Years Programming experience overall:
30+

Have used another Python GUI Framework? (tkinter, Qt, etc) (yes/no is fine)
Yes

Anything else you think would be helpful?


Troubleshooting

These items may solve your problem. Please check those you've done by changing - [ ] to - [X]

  • [X ] Searched main docs for your problem PySimpleGUI Documenation
  • X ] Looked for Demo Programs that are similar to your goal. It is recommend you use the Demo Browser! Demo Programs
  • [X ] None of your GUI code was generated by an AI algorithm like GPT
  • 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.com
  • Have upgraded to the latest release of PySimpleGUI on PyPI (lastest official version)
  • Tried running the Development Build. Your problem may have already been fixed but not released. Check Home Window for release notes and upgrading capability
  • For licensing questions please email license@PySimpleGUI.com
Detailed Description

When trying to change values of checkboxes programatically, I get an error stating that Read or Finalize must be called first. As can be seen below I use "Finalize=True" when creating window, and Read has been called (i.e. the layout and window has been instantiated). I get the error dialogue once for each checkbox, but after clicking the error button the action of checking/unchecing the checkbox has actually been completed correctly.

c:\xxxx\Python\Python312\Lib\site-packages\PySimpleGUIQt\PySimpleGUIQt.py:562: UserWarning: You cannot Update element with key = test2 until the window has been Read or Finalized
warnings.warn('You cannot Update element with key = {} until the window has been Read or Finalized'.format(self.Key), UserWarning)

Code To Duplicate

A short program that isolates and demonstrates the problem (Do not paste your massive program, but instead 10-20 lines that clearly show the problem)

This pre-formatted code block is all set for you to paste in your bit of code:


import PySimpleGUIQt as psg

if __name__ == '__main__':
    
    TRANS_IDX = ['test1', 'test2']

    layout = [  [psg.Checkbox('Testbutton', key='test1')],
                [psg.Checkbox('Testbutton', key='test2')],
                [psg.Button('Select all', key='-sel-', size_px=(110,25)),
                 psg.Button('Deselect all', key='-desel-', size_px=(110,25))]]

    window = psg.Window('Checkbox test', layout, finalize=True)

    while (True):
        event, values = window.read(timeout=1000)
                    
        match (event):
            case '-sel-':
                for tr in TRANS_IDX: 
                    window[tr].update(value=True) # type: psg.Checkbox()
            case '-desel-':
                for tr in TRANS_IDX:
                   window[tr].update(value=False)  # type: psg.Checkbox()

Screenshot, Sketch, or Drawing

image
image


Watcha Makin?

If you care to share something about your project, it would be awesome to hear what you're building.
Building a utility to download blobs from an Azure storage account. Need the checkboxes to select, which blob folders (transaction types) to download. The above example is a subset of code illustrating my problem, which with the above simplified excerpt is identical to what I experience in the actual utility.

Langage dominant
Python
Étoiles
13.8k
Forks
1.8k
Métriques de merge des PR
Aucune PR mergée en 30 j

Guide de contribution

Ouvrir le guide de contribution

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de PySimpleGUI/PySimpleGUI

Toutes les issues de PySimpleGUI/PySimpleGUI

Issues similaires

Plus d'issues Python

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.