Is there a way to preselect/highlight a listbox item with the Tkinter GUI toolkit at the startup of the program without clicking the mouse on it?
sneekula 969 Nearly a Posting Maven
Recommended Answers
Jump to PostHi!
import Tkinter as tk root = tk.Tk() listbox = tk.Listbox(root) listbox.pack() for item in ["one", "two", "three", "four"]: listbox.insert(tk.END, item) listbox.selection_set(first=2) root.mainloop()
Regards, mawe
All 4 Replies
jrcagle 77 Practically a Master Poster
sneekula 969 Nearly a Posting Maven
mawe 6 Junior Poster
sneekula 969 Nearly a Posting Maven
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.