Using TextCtrl
The TextCtrl
control is versatile; it allows the display and entry of textual data in an application. In its default form, TextCtrl
is a single-line entry field that is often used on forms to allow users to input information such as names, places, and descriptions. From wxPython 2.9 onward, TextCtrl
added some features to support auto-completion of input. This feature lets some input help be shown in a pop-up list that filters as the typing narrows down the available options. In this recipe, we will explore how to activate and use some of these features by making a custom the TextCtrl
control that remembers previous entries that were made in it and offers them as input tips the next time data is typed into the field.
How to do it…
Perform the following steps:
First, let's create the class' definition and its constructor to set up the extensions and events that we need to handle in order to add the memory feature:
class MemoryTextCtrl(wx.TextCtrl): """TextCtrl that remembers...