[Bug] Exception for Listbox element with option `horizontal_scroll=True`
frici11 opened this issue · comments
Type of Issue (Enhancement, Error, Bug, Question)
Bug
Operating System
Windows 10 Pro
PySimpleGUI Port (tkinter, Qt, Wx, Web)
tkinter
Versions
Version information can be obtained by calling sg.main_get_debug_data()
Or you can print each version shown in ()
Python version (sg.sys.version
)
3.9.0
PySimpleGUI Version (sg.__version__
)
4.60.0
GUI Version (tkinter (sg.tclversion_detailed
), PySide2, WxPython, Remi)
tkinter 8.6.9
Your Experience In Months or Years (optional)
Years Python programming experience
1,5
Years Programming experience overall
40
Have used another Python GUI Framework? (tkinter, Qt, etc) (yes/no is fine)
no
Anything else you think would be helpful?
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 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
- Tried using the PySimpleGUI.py file on GitHub. Your problem may have already been fixed but not released
Detailed Description
The horizontal_scroll=True property of sg.Listbox element throws an exception in the version 4.60.0.
Error message:
"File "C:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\PySimpleGUI\PySimpleGUI.py", line 15546, in PackFormIntoFrame
element.TKText.config(wrap='none')
AttributeError: 'NoneType' object has no attribute 'config'"
The bug does not depend on the source code, it is related to the version 4.60.0 (I guess the TTK changes)
Code To Duplicate
import PySimpleGUI as sg
sg.Window('Title', [[sg.Listbox([1,2,3,4,5], horizontal_scroll=True)]]).read(close=True)
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.
It should be revised in 4.60.0 for the TTK scrollbars.
Wrong code copy directly from the code for Multiline element.
# Horizontal scrollbar
if element.HorizontalScroll:
element.TKText.config(wrap='none') # Wrong statement, wrong widget and wrong option `wrap`, for Listbox element
_make_ttk_scrollbar(element, 'h', toplevel_form)
element.hsb.pack(side=tk.BOTTOM, fill='x')
element.Widget.configure(xscrollcommand=element.hsb.set)
That's a big oops... will make a new pypi dot-release this weekend for this one. Bad thing to have released for sure. Thank you for the great code snippet!
Fixed in 4.60.0.7
Released in 4.60.1 to PyPI on Sunday 22 May 2022.
(Thank you so much for cleaning up the Issues @jason990420 !)