[Tutor] How to show the listbox from sqlite and make it searchable?
alan.gauld at btinternet.com
Mon Aug 3 22:47:21 CEST 2015
On 03/08/15 13:22, Ali Moradi wrote:
> how can i show the two fields name "esperanto" and "english" in a listbox
> positioned under the entry widget? i want the two fields to be beside
> eachother like (abak/o abacus)
You need to do two things:
1) set the font of the listbox to be monospaced so that
everything lines up
2) format a string with fixed length fields
Then you just insert the strings into the list box as usual.
There are no grid type components in standard Tkinter.
There is one in Tix but it's fiendishly hard to work with
and I don't recommend it. What is worth doing is using
the Tix ScrolledListbox or ScrolledText widgets to hold
the text because you get scroolling almost for nothing.
> and i want to make them searchable via the entry widget like a dictionary
> app :)
Then you will need to write the search code yourself.
extract the lines from the list box or text widget and
check if your search matches. Keep track of the current
line and when found highlight the line or field within
the line as required. Its non trivial but not especially
> and is there any good tutorial on using SQLite with tkinter and how to
> desplay records on GUIs ?
No. There is no magic, Tkinter has no knowledge of SQLite (or
any other database) and vice versa so there is nothing special
to do. You just create strings using the SQL data and insert
them into the GUI.
Tkinter is a very basic, bare bones GUYI tool. That makes
it easy to learn but you have to do a lot of the backend
logic yourself. Other toolkits provide more smarts but
it takes longer to learn them.
Author of the Learn to Program web site
Follow my photo-blog on Flickr at:
More information about the Tutor