I'm using FreeSimpleGUI v5.2.0.post1 in the default TKinter mode. I'd like to override something in the TKinter Listbox object, but I can't figure out how to access it.
The FreeSimpleGui source code contains a FreeSimpleGUI.Listbox class in the file FreeSimpleGUI/elements/list_box.py. Its __init__() method contains a self.TKListbox attribute that I would guess is intended to point to an associated TKinter Listbox object. However, this is set to None in the initializer and is not assigned a value anywhere I can find in the list_box.py file.
FreeSimpleGUI.Listbox extends FreeSimpleGUI.Element and calls its __init__() as part of its own. I can find nothing in that code, either, that clearly invokes the TKinter.Listbox class given the inputs from the FreeSimpleGUI.Listbox initializer.
If I try to take a FreeSimpleGUI.Listbox object in my code and print its self.TKListbox attribute
print(my_sg_listbox.TKListbox)
I get
.!toplevel.!frame.!frame.!frame.!frame2.!frame.!frame.!frame2.!frame.!listbox
which... I don't even know what I'm looking at here.
How do I get to the TKinter.Listbox object associated to a FreeSimpleGUI.Listbox object?
You can access the tkinter widget from FreeSimpleGUI element by it's attribute "widegt" or its special name, like "TKListbox" for the Listbox element.
print(type(window['LISTBOX'].widget))
print(window['LISTBOX'].widget)
print(window['LISTBOX'].TKListbox)
<class 'tkinter.Listbox'>
.!toplevel.!frame.!frame.!listbox
.!toplevel.!frame.!frame.!listbox
".!toplevel.!frame.!frame.!listbox" is the output for the tkinter widget when print.