Bug: Error dialog when programatically updating PySimpleGUIQt Checkbox
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Accessibilité débutants
- 42/100
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
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
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
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de PySimpleGUI/PySimpleGUI
-
Bug Done - Install Dev Build (see docs for how) Platform Specific Issue - Linux Port - TK
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
PySimpleGUI/PySimpleGUI#6904 · 15 commentaires ·
-
Bug Demo Programs Done - Install Dev Build (see docs for how) Interoperability Port - TK workaround available
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
PySimpleGUI/PySimpleGUI#6900 · 1 commentaire ·
-
Done - Install Dev Build (see docs for how) enhancement
Difficulté 2/5 1-3 heures Accessibilité débutants 62/100
PySimpleGUI/PySimpleGUI#3251 · 12 commentaires ·
-
Difficulté 3/5 1-2 jours Accessibilité débutants 74/100
PySimpleGUI/PySimpleGUI#6906 · 1 commentaire · 1 réaction ·
-
Bug Done - Install Dev Build (see docs for how) Port - TK
Difficulté 3/5 1-2 jours Accessibilité débutants 45/100
PySimpleGUI/PySimpleGUI#6902 · 1 commentaire ·
Toutes les issues de PySimpleGUI/PySimpleGUI
Issues similaires
-
essnmx good first issue
Difficulté 1/5 Moins d'une heure Accessibilité débutants 95/100
-
[Feature] 奇物选择添加优先级 Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 65/100
syfoud/Simulated_Scepter#174 ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
Giskard-AI/giskard-oss#2840 · 1 commentaire ·
-
A claim comment carrying the issue number is silently declined while the workflow reports success Ouvertearea: repo bug perceived difficulty: 2
Difficulté 2/5 1-3 heures Accessibilité débutants 70/100
-
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
yeti-platform/yeti#1380 ·