Рет қаралды 5,426
00:38 Different parts of the autocomplete script
01:20 Starting with a blank tkinter window
02:35 Declaring string variable e1_str
02:52 Adding Entry widget
05:04 Adding Listbox widget
09:08 Adding trace method of String variable to trigger get_data() function
10:00 get_data() function
11:49 Regular expression string match
15:10 Adding bind event to Listbox
Part I : Design , adding options and selection
• Tkinter Autocomplete b...
Part II : Navigation and selection by arrows
• Tkinter Autocomplete u...
Part III : Different data sources, Pygsheets , MySQL database
• Tkinter Autocomplete o...
Part IV : Displaying all product attributes on selection
• Tkinter autocomplete r...
Part V: Using colour names as source
• Tkinter autocomplete t...
Source code is here
www.plus2net.com/python/tkint...
As the users will enter string in Entry box , we will offer matching options like Autocomplete by using one listbox and user can select any one option to fill the Entry box.
We will place the Listbox below the Entry widget and keep the ypad=0 so both widgets are placed one below the other.
We will change the Listbox background colour and active border colour same as window background colour to merge the layout of the Listbox with the window.
We will trigger and populate the listbox options by taking data from the source listbox , for this we will use one for loop to list all available options and use regular expression match method to get the strings ( options ) matching to the searched string.
Once the match() method returns true the element is added as option of the Listbox.
We can bind the Listbox selection to pass the selected option as input to Entry widget.
Source code is here
www.plus2net.com/python/tkint...
#AutoComplete #EntryAutocomplete #Tkinter #python #SelectOption #StringMatch #plus2net