Justplayit94
Justplayit94

Reputation: 423

Tkinter Listbox artifact

I am developing a UI that uses a Tkinter Listbox item to display a bunch of dynamically inserted frames that contain other labels. The Listbox works, but in turn it is displaying some weird indexes that I do not want to see in the window. They look like this.
enter image description here
How can I disable these indexes from showing up?
This is the part of code that is responsible for initialising the Listbox

vertical_frame = Listbox(root)

vertical_frame.config(bg="#394144", bd=0, highlightthickness=0, height=10, selectmode=0,
                      activestyle="none", fg="#fff", exportselection=0)  

Also, the frame is used in a function to be able to modify it's contents in a dynamic way. The only thing I do there is

_frame.insert(END, temp_frame)
_frame.pack()  

where _frame stands for vertical_frame, but it is passed to a function. How can I disable the wierd numbers from showing up?

Upvotes: 0

Views: 248

Answers (1)

Bryan Oakley
Bryan Oakley

Reputation: 385880

Those "weird indexes" are the string representation of widgets. To get them to not show up, you need to remove the code that is trying to insert a widget into a listbox. The listbox can only display text.

If you are trying to create a scrollable list of frames, you will need to either embed them in a canvas, or embed them in a text widget. Those are the two widgets that both support scrolling and the embedding of other widgets.

Upvotes: 1

Related Questions