Hi people is it possible to insert Label widget into Listbox in tkinter instead of some str value and attach to it a scrollbar?
Asked
Active
Viewed 3,013 times
-2
-
what have you tried? It is possible to put a listbox into tkinter with a scrollbar, or you can add a dropdown list which will make it a little cleaner. – st.ph.n Jun 16 '16 at 17:14
-
http://pastebin.com/2MjnqvPx Till now i have tried this i try to pass instead of str object labelframe to insert but it does not work. I dont know if there are ways to do it – mightycoder Jun 16 '16 at 17:18
2 Answers
1
Based on the documentation online, No
The listbox can only contain text items...
for further details on the ListBox: http://effbot.org/tkinterbook/listbox.htm

glls
- 2,325
- 1
- 22
- 39
-
what is the proper way to create scrollable list of labels in tkinter? – mightycoder Jun 16 '16 at 17:27
-
that is another question, and is properly documented in the link I provided – glls Jun 16 '16 at 17:29
-
0
Don't ask me to explain it because I really don't understand it yet, but this should work:
import tkinter as tk # python3
root = tk.Tk()
myList = tk.Listbox(root)
myText = "A list item"
myList.insert(tk.END, myText)
myList.pack()
lbl = tk.Label(myList, text=myText, anchor="w", font=("Helvetica", "24"))
lbl.pack(side="top", fill="x", anchor="w")
root.mainloop()

patcou
- 41
- 2