Discussion:
[Tutor] How to make clickable listbox from database by Tkinter
Ali Moradi
2015-06-15 07:11:37 UTC
Permalink
hi, i use python 2.

how can i add a listbox under the entry and button widgets?

i want to use database to fill the listbox, both fields in the database
(English and Esperanto)

listbox should be like this (words are beside eachother:

*English* *Esperanto*
water akvo
father patro

and so on...

it's a dictionary app.

i want to make the items in the list searchable, and when the user types
and clicks on the button, it shows the word.

files are attached.

thanks a bunch, i'm a beginner in python! :)
_______________________________________________
Tutor maillist - ***@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
Alan Gauld
2015-06-15 08:03:09 UTC
Permalink
Post by Ali Moradi
how can i add a listbox under the entry and button widgets?
Can you clarify that sentence? What do you mean by "under"?
Do you want the list box to be located on the same form as
two widgets but underneath? Or do you want the listbox
to appear when you press the button?

If its the first then it will be down to using the
correct layout manager (pack, grid, place etc) in
conjunction with one or more Frame containers.

If its the second the jn you will need to say where
the listbox should appear: in a dialog or on the
existing form.
Post by Ali Moradi
i want to use database to fill the listbox, both fields in the database
(English and Esperanto)
What kind of database? You can attach Python to most databases
but there are differences depending on the exact database
you use. Is it SQL or a flat file database?
Post by Ali Moradi
*English* *Esperanto*
water akvo
father patro
and so on...
That's probably just a string formatting task.
Post by Ali Moradi
i want to make the items in the list searchable, and when the user types
and clicks on the button, it shows the word.
You must be more specific. We can't read your mind.
If the user clicks on the button it should show which word?

I assume you mean if the user enters a word in the entry
widget and then presses the button then the list box should
arrange its contents such that the user word and its pair
are both visible? And maybe highlighted too?

I'm guessing that the word entered can be in either English
or Esperanto? So if the user enters 'water' it will show
and highlight the line:
"water akvo"
And if the user enters the word 'patro' it will show
and highlight the line:
"father patro"

Is that what you mean?
Post by Ali Moradi
files are attached.
This is a text based mailing list, your attachments have
disappeared in transit (at least for me). Please send the files
as text embedded in your mail. (Please be sure to use plain
text email for this as HTML will mess up the formatting).
If the files are long, say >100 lines put them on a pastebin
type site and send a link.
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos


_______________________________________________
Tutor maillist - ***@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
Loading...