Python Forum
[Tkinter] Getting First 3 characters in a listbox - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: GUI (https://python-forum.io/forum-10.html)
+--- Thread: [Tkinter] Getting First 3 characters in a listbox (/thread-22384.html)



Getting First 3 characters in a listbox - scratchmyhead - Nov-10-2019

I'm new to Python so bare with me. I have googled this but can't seem to find the answer. How do I get the first three characters in a Tkinter listbox. Thanks.

Jeff


RE: Getting First 3 characters in a listbox - scratchmyhead - Nov-11-2019

This is one way of getting it:

 
variable1 = listbox1.get(0)
    print(variable1[:3])