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 [email protected]
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.