Text control with autocomplete (Phoenix)

Keywords : TextCtrl, AutoComplete, Autocompletion.


Demonstrating :

Tested py3.x, wx4.x and Win10.

Are you ready to use some samples ? ;)

Test, modify, correct, complete, improve and share your discoveries ! (!)


Autocomplete

img_sample_one.png

ICON file : wxwin.ico

   1 # sample_one.py
   2 
   3 import os
   4 import wx
   5 
   6 # class MyClassCompleterSimple
   7 # class MyClassCompleter
   8 # class MyMainFrame
   9 # class MyApp
  10 
  11 szClasses = [
  12     'wxAboutDialogInfo',
  13     'wxAcceleratorEntry',
  14     'wxAcceleratorTable',
  15     'wxAccessible',
  16     'wxActivateEvent',
  17     'wxActiveXContainer',
  18     'wxAddRemoveCtrl',
  19     'wxAffineMatrix2D',
  20     'wxAffineMatrix2DBase',
  21     'wxAnimation',
  22     'wxAnimationCtrl',
  23     'wxAny',
  24     'wxAnyButton',
  25     'wxAnyValueBuffer',
  26     'wxAnyValueType',
  27     'wxApp',
  28     'wxAppConsole',
  29     'wxAppProgressIndicator',
  30     'wxAppTraits',
  31     'wxArchiveClassFactory',
  32     'wxArchiveEntry',
  33     'wxArchiveFSHandler',
  34     'wxArchiveInputStream',
  35     'wxArchiveIterator',
  36     'wxArchiveNotifier',
  37     'wxArchiveOutputStream',
  38     'wxArray<',
  39     'wxArrayString',
  40     'wxArrayStringProperty',
  41     'wxArtProvider',
  42     'wxAuiDefaultDockArt',
  43     'wxAuiDefaultTabArt',
  44     'wxAuiDefaultToolBarArt',
  45     'wxAuiDockArt',
  46     'wxAuiDockInfo',
  47     'wxAuiDockUIPart',
  48     'wxAuiFloatingFrame',
  49     'wxAuiManager',
  50     'wxAuiManagerEvent',
  51     'wxAuiMDIChildFrame',
  52     'wxAuiMDIClientWindow',
  53     'wxAuiMDIParentFrame',
  54     'wxAuiNotebook',
  55     'wxAuiNotebookEvent',
  56     'wxAuiNotebookPage',
  57     'wxAuiPaneButton',
  58     'wxAuiPaneInfo',
  59     'wxAuiSimpleTabArt',
  60     'wxAuiTabArt',
  61     'wxAuiTabContainer',
  62     'wxAuiTabContainerButton',
  63     'wxAuiToolBar',
  64     'wxAuiToolBarArt',
  65     'wxAuiToolBarEvent',
  66     'wxAuiToolBarItem',
  67     'wxAutoBufferedPaintDC',
  68     'wxAutomationObject',
  69     'wxBannerWindow',
  70     'wxBitmap',
  71     'wxBitmapButton',
  72     'wxBitmapComboBox',
  73     'wxBitmapDataObject',
  74     'wxBitmapHandler',
  75     'wxBitmapToggleButton',
  76     'wxBookCtrlBase',
  77     'wxBookCtrlEvent',
  78     'wxBoolProperty',
  79     'wxBoxSizer',
  80     'wxBrush',
  81     'wxBrushList',
  82     'wxBufferedDC',
  83     'wxBufferedInputStream',
  84     'wxBufferedOutputStream',
  85     'wxBufferedPaintDC',
  86     'wxBusyCursor',
  87     'wxBusyInfo',
  88     'wxBusyInfoFlags',
  89     'wxButton',
  90     'wxCalculateLayoutEvent',
  91     'wxCalendarCtrl',
  92     'wxCalendarDateAttr',
  93     'wxCalendarEvent',
  94     'wxCaret',
  95     'wxCharBuffer',
  96     'wxCharTypeBuffer',
  97     'wxCheckBox',
  98     'wxCheckListBox',
  99     'wxChildFocusEvent',
 100     'wxChoice',
 101     'wxChoicebook',
 102     'wxClassInfo',
 103     'wxClient',
 104     'wxClientData',
 105     'wxClientDataContainer',
 106     'wxClientDC',
 107     'wxClipboard',
 108     'wxClipboardTextEvent',
 109     'wxCloseEvent',
 110     'wxCmdLineArg',
 111     'wxCmdLineArgs',
 112     'wxCmdLineEntryDesc',
 113     'wxCmdLineParser',
 114     'wxCollapsibleHeaderCtrl',
 115     'wxCollapsiblePane',
 116     'wxCollapsiblePaneEvent',
 117     'wxColour',
 118     'wxColourData',
 119     'wxColourDatabase',
 120     'wxColourDialog',
 121     'wxColourPickerCtrl',
 122     'wxColourPickerEvent',
 123     'wxColourProperty',
 124     'wxColourPropertyValue',
 125     'wxComboBox',
 126     'wxComboCtrl',
 127     'wxComboCtrlFeatures',
 128     'wxComboPopup',
 129     'wxCommand',
 130     'wxCommandEvent',
 131     'wxCommandLinkButton',
 132     'wxCommandProcessor',
 133     'wxCondition',
 134     'wxConfigBase',
 135     'wxConfigPathChanger',
 136     'wxConnection',
 137     'wxConnectionBase',
 138     'wxContextHelp',
 139     'wxContextHelpButton',
 140     'wxContextMenuEvent',
 141     'wxControl',
 142     'wxControlWithItems',
 143     'wxConvAuto',
 144     'wxCountingOutputStream',
 145     'wxCriticalSection',
 146     'wxCriticalSectionLocker',
 147     'wxCSConv',
 148     'wxCursor',
 149     'wxCursorProperty',
 150     'wxCustomBackgroundWindow',
 151     'wxCustomDataObject',
 152     'wxDataFormat',
 153     'wxDatagramSocket',
 154     'wxDataInputStream',
 155     'wxDataObject',
 156     'wxDataObjectComposite',
 157     'wxDataObjectSimple',
 158     'wxDataOutputStream',
 159     'wxDataViewBitmapRenderer',
 160     'wxDataViewCheckIconTextRenderer',
 161     'wxDataViewChoiceByIndexRenderer',
 162     'wxDataViewChoiceRenderer',
 163     'wxDataViewColumn',
 164     'wxDataViewCtrl',
 165     'wxDataViewCustomRenderer',
 166     'wxDataViewDateRenderer',
 167     'wxDataViewEvent',
 168     'wxDataViewIconText',
 169     'wxDataViewIconTextRenderer',
 170     'wxDataViewIndexListModel',
 171     'wxDataViewItem',
 172     'wxDataViewItemAttr',
 173     'wxDataViewListCtrl',
 174     'wxDataViewListModel',
 175     'wxDataViewListStore',
 176     'wxDataViewModel',
 177     'wxDataViewModelNotifier',
 178     'wxDataViewProgressRenderer',
 179     'wxDataViewRenderer',
 180     'wxDataViewSpinRenderer',
 181     'wxDataViewTextRenderer',
 182     'wxDataViewToggleRenderer',
 183     'wxDataViewTreeCtrl',
 184     'wxDataViewTreeStore',
 185     'wxDataViewValueAdjuster',
 186     'wxDataViewVirtualListModel',
 187     'wxDateEvent',
 188     'wxDatePickerCtrl',
 189     'wxDateProperty',
 190     'wxDateSpan',
 191     'wxDateTime',
 192     'TimeZone',
 193     'Tm',
 194     'wxDateTimeHolidayAuthority',
 195     'wxDateTimeWorkDays',
 196     'wxDC',
 197     'wxDCBrushChanger',
 198     'wxDCClipper',
 199     'wxDCFontChanger',
 200     'wxDCOverlay',
 201     'wxDCPenChanger',
 202     'wxDCTextColourChanger',
 203     'wxDDEClient',
 204     'wxDDEConnection',
 205     'wxDDEServer',
 206     'wxDebugContext',
 207     'wxDebugReport',
 208     'wxDebugReportCompress',
 209     'wxDebugReportPreview',
 210     'wxDebugReportPreviewStd',
 211     'wxDebugReportUpload',
 212     'wxDelegateRendererNative',
 213     'wxDialog',
 214     'wxDialogLayoutAdapter',
 215     'wxDialUpEvent',
 216     'wxDialUpManager',
 217     'wxDir',
 218     'wxDirDialog',
 219     'wxDirFilterListCtrl',
 220     'wxDirPickerCtrl',
 221     'wxDirProperty',
 222     'wxDirTraverser',
 223     'wxDisplay',
 224     'wxDisplayChangedEvent',
 225     'wxDocChildFrame',
 226     'wxDocManager',
 227     'wxDocMDIChildFrame',
 228     'wxDocMDIParentFrame',
 229     'wxDocParentFrame',
 230     'wxDocTemplate',
 231     'wxDocument',
 232     'wxDragImage',
 233     'wxDropFilesEvent',
 234     'wxDropSource',
 235     'wxDropTarget',
 236     'wxDynamicLibrary',
 237     'wxDynamicLibraryDetails',
 238     'wxEditableListBox',
 239     'wxEditEnumProperty',
 240     'wxEncodingConverter',
 241     'wxEnumProperty',
 242     'wxEraseEvent',
 243     'wxEvent',
 244     'wxEventBlocker',
 245     'wxEventFilter',
 246     'wxEventLoopActivator',
 247     'wxEventLoopBase',
 248     'wxEvtHandler',
 249     'wxExecuteEnv',
 250     'wxExtHelpController',
 251     'wxFFile',
 252     'wxFFileInputStream',
 253     'wxFFileOutputStream',
 254     'wxFFileStream',
 255     'wxFile',
 256     'wxFileConfig',
 257     'wxFileCtrl',
 258     'wxFileCtrlEvent',
 259     'wxFileDataObject',
 260     'wxFileDialog',
 261     'wxFileDirPickerEvent',
 262     'wxFileDropTarget',
 263     'wxFileHistory',
 264     'wxFileInputStream',
 265     'wxFileName',
 266     'wxFileOutputStream',
 267     'wxFilePickerCtrl',
 268     'wxFileProperty',
 269     'wxFileStream',
 270     'wxFileSystem',
 271     'wxFileSystemHandler',
 272     'wxFileSystemWatcher',
 273     'wxFileSystemWatcherEvent',
 274     'wxFileTranslationsLoader',
 275     'wxFileType',
 276     'MessageParameters',
 277     'wxFileTypeInfo',
 278     'wxFilterClassFactory',
 279     'wxFilterFSHandler',
 280     'wxFilterInputStream',
 281     'wxFilterOutputStream',
 282     'wxFindDialogEvent',
 283     'wxFindReplaceData',
 284     'wxFindReplaceDialog',
 285     'wxFlagsProperty',
 286     'wxFlexGridSizer',
 287     'wxFloatingPointValidator',
 288     'wxFloatProperty',
 289     'wxFocusEvent',
 290     'wxFont',
 291     'wxFontData',
 292     'wxFontDialog',
 293     'wxFontEnumerator',
 294     'wxFontInfo',
 295     'wxFontList',
 296     'wxFontMapper',
 297     'wxFontMetrics',
 298     'wxFontPickerCtrl',
 299     'wxFontPickerEvent',
 300     'wxFontProperty',
 301     'wxFrame',
 302     'wxFSFile',
 303     'wxFSInputStream',
 304     'wxFSVolume',
 305     'wxFTP',
 306     'wxGauge',
 307     'wxGBPosition',
 308     'wxGBSizerItem',
 309     'wxGBSpan',
 310     'wxGCDC',
 311     'wxGDIObject',
 312     'wxGenericAboutDialog',
 313     'wxGenericDirCtrl',
 314     'wxGenericProgressDialog',
 315     'wxGenericValidator',
 316     'wxGestureEvent',
 317     'wxGIFHandler',
 318     'wxGLAttribsBase',
 319     'wxGLAttributes',
 320     'wxGLCanvas',
 321     'wxGLContext',
 322     'wxGLContextAttrs',
 323     'wxGraphicsBitmap',
 324     'wxGraphicsBrush',
 325     'wxGraphicsContext',
 326     'wxGraphicsFont',
 327     'wxGraphicsGradientStop',
 328     'wxGraphicsGradientStops',
 329     'wxGraphicsMatrix',
 330     'wxGraphicsObject',
 331     'wxGraphicsPath',
 332     'wxGraphicsPen',
 333     'wxGraphicsPenInfo',
 334     'wxGraphicsRenderer',
 335     'wxGrid',
 336     'wxGridBagSizer',
 337     'wxGridCellAttr',
 338     'wxGridCellAttrProvider',
 339     'wxGridCellAutoWrapStringEditor',
 340     'wxGridCellAutoWrapStringRenderer',
 341     'wxGridCellBoolEditor',
 342     'wxGridCellBoolRenderer',
 343     'wxGridCellChoiceEditor',
 344     'wxGridCellCoords',
 345     'wxGridCellDateTimeRenderer',
 346     'wxGridCellEditor',
 347     'wxGridCellEnumEditor',
 348     'wxGridCellEnumRenderer',
 349     'wxGridCellFloatEditor',
 350     'wxGridCellFloatRenderer',
 351     'wxGridCellNumberEditor',
 352     'wxGridCellNumberRenderer',
 353     'wxGridCellRenderer',
 354     'wxGridCellStringRenderer',
 355     'wxGridCellTextEditor',
 356     'wxGridColumnHeaderRenderer',
 357     'wxGridColumnHeaderRendererDefault',
 358     'wxGridCornerHeaderRenderer',
 359     'wxGridCornerHeaderRendererDefault',
 360     'wxGridEditorCreatedEvent',
 361     'wxGridEvent',
 362     'wxGridHeaderLabelsRenderer',
 363     'wxGridRangeSelectEvent',
 364     'wxGridRowHeaderRenderer',
 365     'wxGridRowHeaderRendererDefault',
 366     'wxGridSizeEvent',
 367     'wxGridSizer',
 368     'wxGridSizesInfo',
 369     'wxGridStringTable',
 370     'wxGridTableBase',
 371     'wxGridTableMessage',
 372     'wxGridUpdateLocker',
 373     'wxGUIEventLoop',
 374     'wxHashMap',
 375     'wxHashSet',
 376     'wxHashTable',
 377     'wxHeaderButtonParams',
 378     'wxHeaderColumn',
 379     'wxHeaderColumnSimple',
 380     'wxHeaderCtrl',
 381     'wxHeaderCtrlEvent',
 382     'wxHeaderCtrlSimple',
 383     'wxHelpController',
 384     'wxHelpControllerBase',
 385     'wxHelpControllerHelpProvider',
 386     'wxHelpEvent',
 387     'wxHelpProvider',
 388     'wxHScrolledWindow',
 389     'wxHtmlBookRecord',
 390     'wxHtmlCell',
 391     'wxHtmlCellEvent',
 392     'wxHtmlColourCell',
 393     'wxHtmlContainerCell',
 394     'wxHTMLDataObject',
 395     'wxHtmlDCRenderer',
 396     'wxHtmlEasyPrinting',
 397     'wxHtmlFilter',
 398     'wxHtmlFontCell',
 399     'wxHtmlHelpController',
 400     'wxHtmlHelpData',
 401     'wxHtmlHelpDataItem',
 402     'wxHtmlHelpDialog',
 403     'wxHtmlHelpFrame',
 404     'wxHtmlHelpWindow',
 405     'wxHtmlLinkEvent',
 406     'wxHtmlLinkInfo',
 407     'wxHtmlListBox',
 408     'wxHtmlModalHelp',
 409     'wxHtmlParser',
 410     'wxHtmlPrintout',
 411     'wxHtmlRenderingInfo',
 412     'wxHtmlRenderingState',
 413     'wxHtmlRenderingStyle',
 414     'wxHtmlSelection',
 415     'wxHtmlTag',
 416     'wxHtmlTagHandler',
 417     'wxHtmlTagsModule',
 418     'wxHtmlWidgetCell',
 419     'wxHtmlWindow',
 420     'wxHtmlWindowInterface',
 421     'wxHtmlWinParser',
 422     'wxHtmlWinTagHandler',
 423     'wxHtmlWordCell',
 424     'wxHtmlWordWithTabsCell',
 425     'wxHTTP',
 426     'wxHVScrolledWindow',
 427     'wxHyperlinkCtrl',
 428     'wxHyperlinkEvent',
 429     'wxIcon',
 430     'wxIconBundle',
 431     'wxIconizeEvent',
 432     'wxIconLocation',
 433     'wxIdleEvent',
 434     'wxIdManager',
 435     'wxIFFHandler',
 436     'wxImage',
 437     'HSVValue',
 438     'RGBValue',
 439     'wxImageFileProperty',
 440     'wxImageHandler',
 441     'wxImageHistogram',
 442     'wxImageList',
 443     'wxIndividualLayoutConstraint',
 444     'wxInfoBar',
 445     'wxInitDialogEvent',
 446     'wxInitializer',
 447     'wxInputStream',
 448     'wxIntegerValidator',
 449     'wxInternetFSHandler',
 450     'wxIntProperty',
 451     'wxIPaddress',
 452     'wxIPV4address',
 453     'wxItemAttr',
 454     'wxItemContainer',
 455     'wxItemContainerImmutable',
 456     'wxJoystick',
 457     'wxJoystickEvent',
 458     'wxJPEGHandler',
 459     'wxKeyboardState',
 460     'wxKeyEvent',
 461     'wxLanguageInfo',
 462     'wxLayoutAlgorithm',
 463     'wxLayoutConstraints',
 464     'wxLinuxDistributionInfo',
 465     'wxList<',
 466     'wxListbook',
 467     'wxListBox',
 468     'wxListCtrl',
 469     'wxListEvent',
 470     'wxListItem',
 471     'wxListView',
 472     'wxLocale',
 473     'wxLog',
 474     'wxLogBuffer',
 475     'wxLogChain',
 476     'wxLogFormatter',
 477     'wxLogGui',
 478     'wxLogInterposer',
 479     'wxLogInterposerTemp',
 480     'wxLogNull',
 481     'wxLogRecordInfo',
 482     'wxLogStderr',
 483     'wxLogStream',
 484     'wxLogTextCtrl',
 485     'wxLogWindow',
 486     'wxLongLong',
 487     'wxLongPressEvent',
 488     'wxLongStringProperty',
 489     'wxMask',
 490     'wxMatrix2D',
 491     'wxMaximizeEvent',
 492     'wxMBConv',
 493     'wxMBConvUTF16',
 494     'wxMBConvUTF32',
 495     'wxMBConvUTF7',
 496     'wxMBConvUTF8',
 497     'wxMDIChildFrame',
 498     'wxMDIClientWindow',
 499     'wxMDIParentFrame',
 500     'wxMediaCtrl',
 501     'wxMediaEvent',
 502     'wxMemoryBuffer',
 503     'wxMemoryDC',
 504     'wxMemoryFSHandler',
 505     'wxMemoryInputStream',
 506     'wxMemoryOutputStream',
 507     'wxMenu',
 508     'wxMenuBar',
 509     'wxMenuEvent',
 510     'wxMenuItem',
 511     'wxMessageDialog',
 512     'ButtonLabel',
 513     'wxMessageOutput',
 514     'wxMessageOutputBest',
 515     'wxMessageOutputDebug',
 516     'wxMessageOutputMessageBox',
 517     'wxMessageOutputStderr',
 518     'wxMessageQueue<',
 519     'wxMetafile',
 520     'wxMetafileDC',
 521     'wxMimeTypesManager',
 522     'wxMiniFrame',
 523     'wxMirrorDC',
 524     'wxModalDialogHook',
 525     'wxModule',
 526     'wxMouseCaptureChangedEvent',
 527     'wxMouseCaptureLostEvent',
 528     'wxMouseEvent',
 529     'wxMouseEventsManager',
 530     'wxMouseState',
 531     'wxMoveEvent',
 532     'wxMsgCatalog',
 533     'wxMultiChoiceDialog',
 534     'wxMultiChoiceProperty',
 535     'wxMutex',
 536     'wxMutexLocker',
 537     'wxNativeFontInfo',
 538     'wxNativeWindow',
 539     'wxNavigationEnabled',
 540     'wxNavigationKeyEvent',
 541     'wxNode<',
 542     'wxNonOwnedWindow',
 543     'wxNotebook',
 544     'wxNotificationMessage',
 545     'wxNotifyEvent',
 546     'wxNumberFormatter',
 547     'wxNumericPropertyValidator',
 548     'wxNumValidator',
 549     'wxObject',
 550     'wxObjectDataPtr<',
 551     'wxObjectRefData',
 552     'wxOutputStream',
 553     'wxOverlay',
 554     'wxOwnerDrawnComboBox',
 555     'wxPageSetupDialog',
 556     'wxPageSetupDialogData',
 557     'wxPaintDC',
 558     'wxPaintEvent',
 559     'wxPalette',
 560     'wxPaletteChangedEvent',
 561     'wxPanel',
 562     'wxPanGestureEvent',
 563     'wxPasswordEntryDialog',
 564     'wxPathList',
 565     'wxPCXHandler',
 566     'wxPen',
 567     'wxPenInfo',
 568     'wxPenList',
 569     'wxPersistenceManager',
 570     'wxPersistentBookCtrl',
 571     'wxPersistentDataViewCtrl',
 572     'wxPersistentObject',
 573     'wxPersistentTLW',
 574     'wxPersistentTreeBookCtrl',
 575     'wxPersistentWindow',
 576     'wxPGArrayEditorDialog',
 577     'wxPGArrayStringEditorDialog',
 578     'wxPGAttributeStorage',
 579     'wxPGCell',
 580     'wxPGCellData',
 581     'wxPGCellRenderer',
 582     'wxPGCheckBoxEditor',
 583     'wxPGChoiceAndButtonEditor',
 584     'wxPGChoiceEditor',
 585     'wxPGChoiceEntry',
 586     'wxPGChoices',
 587     'wxPGChoicesData',
 588     'wxPGComboBoxEditor',
 589     'wxPGDefaultRenderer',
 590     'wxPGEditor',
 591     'wxPGEditorDialogAdapter',
 592     'wxPGFileDialogAdapter',
 593     'wxPGInDialogValidator',
 594     'wxPGLongStringDialogAdapter',
 595     'wxPGMultiButton',
 596     'wxPGPaintData',
 597     'wxPGPropArgCls',
 598     'wxPGProperty',
 599     'wxPGRootProperty',
 600     'wxPGSpinCtrlEditor',
 601     'wxPGTextCtrlAndButtonEditor',
 602     'wxPGTextCtrlEditor',
 603     'wxPGValidationInfo',
 604     'wxPGVIterator',
 605     'wxPGWindowList',
 606     'wxPickerBase',
 607     'wxPixelData',
 608     'Iterator',
 609     'wxPlatformInfo',
 610     'wxPNGHandler',
 611     'wxPNMHandler',
 612     'wxPoint',
 613     'wxPoint2DDouble',
 614     'wxPoint2DInt',
 615     'wxPopupTransientWindow',
 616     'wxPopupWindow',
 617     'wxPosition',
 618     'wxPostScriptDC',
 619     'wxPowerEvent',
 620     'wxPowerResource',
 621     'wxPowerResourceBlocker',
 622     'wxPreferencesEditor',
 623     'wxPreferencesPage',
 624     'wxPressAndTapEvent',
 625     'wxPreviewCanvas',
 626     'wxPreviewControlBar',
 627     'wxPreviewFrame',
 628     'wxPrintAbortDialog',
 629     'wxPrintData',
 630     'wxPrintDialog',
 631     'wxPrintDialogData',
 632     'wxPrinter',
 633     'wxPrinterDC',
 634     'wxPrintout',
 635     'wxPrintPreview',
 636     'wxProcess',
 637     'wxProcessEvent',
 638     'wxProgressDialog',
 639     'wxPropagateOnce',
 640     'wxPropagationDisabler',
 641     'wxPropertyCategory',
 642     'wxPropertyGrid',
 643     'wxPropertyGridConstIterator',
 644     'wxPropertyGridEvent',
 645     'wxPropertyGridHitTestResult',
 646     'wxPropertyGridInterface',
 647     'wxPropertyGridIterator',
 648     'wxPropertyGridIteratorBase',
 649     'wxPropertyGridManager',
 650     'wxPropertyGridPage',
 651     'wxPropertyGridPageState',
 652     'wxPropertyGridPopulator',
 653     'wxPropertySheetDialog',
 654     'wxProtocol',
 655     'wxProtocolLog',
 656     'wxQuantize',
 657     'wxQueryLayoutInfoEvent',
 658     'wxQueryNewPaletteEvent',
 659     'wxRadioBox',
 660     'wxRadioButton',
 661     'wxRealPoint',
 662     'wxRearrangeCtrl',
 663     'wxRearrangeDialog',
 664     'wxRearrangeList',
 665     'wxRect',
 666     'wxRect2DDouble',
 667     'wxRect2DInt',
 668     'wxRecursionGuard',
 669     'wxRecursionGuardFlag',
 670     'wxRefCounter',
 671     'wxRegConfig',
 672     'wxRegEx',
 673     'wxRegion',
 674     'wxRegionIterator',
 675     'wxRegKey',
 676     'wxRendererNative',
 677     'wxRendererVersion',
 678     'wxResourceTranslationsLoader',
 679     'wxRibbonArtProvider',
 680     'wxRibbonAUIArtProvider',
 681     'wxRibbonBar',
 682     'wxRibbonBarEvent',
 683     'wxRibbonButtonBar',
 684     'wxRibbonButtonBarEvent',
 685     'wxRibbonControl',
 686     'wxRibbonGallery',
 687     'wxRibbonGalleryEvent',
 688     'wxRibbonMSWArtProvider',
 689     'wxRibbonPage',
 690     'wxRibbonPageTabInfo',
 691     'wxRibbonPanel',
 692     'wxRibbonPanelEvent',
 693     'wxRibbonToolBar',
 694     'wxRibbonToolBarEvent',
 695     'wxRichMessageDialog',
 696     'wxRichTextAction',
 697     'wxRichTextAttr',
 698     'wxRichTextBox',
 699     'wxRichTextBuffer',
 700     'wxRichTextBufferDataObject',
 701     'wxRichTextCell',
 702     'wxRichTextCharacterStyleDefinition',
 703     'wxRichTextCommand',
 704     'wxRichTextCompositeObject',
 705     'wxRichTextContextMenuPropertiesInfo',
 706     'wxRichTextCtrl',
 707     'wxRichTextDrawingContext',
 708     'wxRichTextDrawingHandler',
 709     'wxRichTextEvent',
 710     'wxRichTextField',
 711     'wxRichTextFieldType',
 712     'wxRichTextFieldTypeStandard',
 713     'wxRichTextFileHandler',
 714     'wxRichTextFontTable',
 715     'wxRichTextFormattingDialog',
 716     'wxRichTextFormattingDialogFactory',
 717     'wxRichTextHeaderFooterData',
 718     'wxRichTextHTMLHandler',
 719     'wxRichTextImage',
 720     'wxRichTextImageBlock',
 721     'wxRichTextLine',
 722     'wxRichTextListStyleDefinition',
 723     'wxRichTextObject',
 724     'wxRichTextObjectAddress',
 725     'wxRichTextParagraph',
 726     'wxRichTextParagraphLayoutBox',
 727     'wxRichTextParagraphStyleDefinition',
 728     'wxRichTextPlainText',
 729     'wxRichTextPlainTextHandler',
 730     'wxRichTextPrinting',
 731     'wxRichTextPrintout',
 732     'wxRichTextProperties',
 733     'wxRichTextRange',
 734     'wxRichTextRenderer',
 735     'wxRichTextSelection',
 736     'wxRichTextStdRenderer',
 737     'wxRichTextStyleComboCtrl',
 738     'wxRichTextStyleDefinition',
 739     'wxRichTextStyleListBox',
 740     'wxRichTextStyleListCtrl',
 741     'wxRichTextStyleOrganiserDialog',
 742     'wxRichTextStyleSheet',
 743     'wxRichTextTable',
 744     'wxRichTextTableBlock',
 745     'wxRichTextXMLHandler',
 746     'wxRichToolTip',
 747     'wxRotateGestureEvent',
 748     'wxSashEvent',
 749     'wxSashLayoutWindow',
 750     'wxSashWindow',
 751     'wxScopedArray',
 752     'wxScopedCharTypeBuffer',
 753     'wxScopedPtr',
 754     'wxScopedPtr<',
 755     'wxScopedTiedPtr',
 756     'wxScopeGuard',
 757     'wxScreenDC',
 758     'wxScrollBar',
 759     'wxScrolled',
 760     'wxScrollEvent',
 761     'wxScrollWinEvent',
 762     'wxSearchCtrl',
 763     'wxSecretStore',
 764     'wxSecretValue',
 765     'wxSemaphore',
 766     'wxServer',
 767     'wxSetCursorEvent',
 768     'wxSettableHeaderColumn',
 769     'wxSharedPtr<',
 770     'wxShowEvent',
 771     'wxSimplebook',
 772     'wxSimpleHelpProvider',
 773     'wxSimpleHtmlListBox',
 774     'wxSingleChoiceDialog',
 775     'wxSingleInstanceChecker',
 776     'wxSize',
 777     'wxSizeEvent',
 778     'wxSizer',
 779     'wxSizerFlags',
 780     'wxSizerItem',
 781     'wxSizerXmlHandler',
 782     'wxSlider',
 783     'wxSockAddress',
 784     'wxSocketBase',
 785     'wxSocketClient',
 786     'wxSocketEvent',
 787     'wxSocketInputStream',
 788     'wxSocketOutputStream',
 789     'wxSocketServer',
 790     'wxSortedArrayString',
 791     'wxSound',
 792     'wxSpinButton',
 793     'wxSpinCtrl',
 794     'wxSpinCtrlDouble',
 795     'wxSpinDoubleEvent',
 796     'wxSpinEvent',
 797     'wxSplashScreen',
 798     'wxSplitterEvent',
 799     'wxSplitterRenderParams',
 800     'wxSplitterWindow',
 801     'wxStack<',
 802     'wxStackFrame',
 803     'wxStackWalker',
 804     'wxStandardPaths',
 805     'wxStaticBitmap',
 806     'wxStaticBox',
 807     'wxStaticBoxSizer',
 808     'wxStaticLine',
 809     'wxStaticText',
 810     'wxStatusBar',
 811     'wxStatusBarPane',
 812     'wxStdDialogButtonSizer',
 813     'wxStdInputStream',
 814     'wxStdInputStreamBuffer',
 815     'wxStdOutputStream',
 816     'wxStdOutputStreamBuffer',
 817     'wxStockPreferencesPage',
 818     'wxStopWatch',
 819     'wxStreamBase',
 820     'wxStreamBuffer',
 821     'wxStreamToTextRedirector',
 822     'wxString',
 823     'wxStringBuffer',
 824     'wxStringBufferLength',
 825     'wxStringClientData',
 826     'wxStringInputStream',
 827     'wxStringOutputStream',
 828     'wxStringProperty',
 829     'wxStringTokenizer',
 830     'wxStyledTextCtrl',
 831     'wxStyledTextEvent',
 832     'wxSVGBitmapEmbedHandler',
 833     'wxSVGBitmapFileHandler',
 834     'wxSVGBitmapHandler',
 835     'wxSVGFileDC',
 836     'wxSymbolPickerDialog',
 837     'wxSysColourChangedEvent',
 838     'wxSystemColourProperty',
 839     'wxSystemOptions',
 840     'wxSystemSettings',
 841     'wxSystemThemedControl',
 842     'wxTarClassFactory',
 843     'wxTarEntry',
 844     'wxTarInputStream',
 845     'wxTarOutputStream',
 846     'wxTaskBarButton',
 847     'wxTaskBarIcon',
 848     'wxTaskBarIconEvent',
 849     'wxTaskBarJumpList',
 850     'wxTaskBarJumpListCategory',
 851     'wxTaskBarJumpListItem',
 852     'wxTCPClient',
 853     'wxTCPConnection',
 854     'wxTCPServer',
 855     'wxTempFile',
 856     'wxTempFileOutputStream',
 857     'wxTextAttr',
 858     'wxTextAttrBorder',
 859     'wxTextAttrBorders',
 860     'wxTextAttrDimension',
 861     'wxTextAttrDimensionConverter',
 862     'wxTextAttrDimensions',
 863     'wxTextAttrShadow',
 864     'wxTextAttrSize',
 865     'wxTextBoxAttr',
 866     'wxTextCompleter',
 867     'wxTextCompleterSimple',
 868     'wxTextCtrl',
 869     'wxTextDataObject',
 870     'wxTextDropTarget',
 871     'wxTextEntry',
 872     'wxTextEntryDialog',
 873     'wxTextFile',
 874     'wxTextInputStream',
 875     'wxTextOutputStream',
 876     'wxTextUrlEvent',
 877     'wxTextValidator',
 878     'wxTextWrapper',
 879     'wxTGAHandler',
 880     'wxThread',
 881     'wxThreadEvent',
 882     'wxThreadHelper',
 883     'wxThumbBarButton',
 884     'wxTIFFHandler',
 885     'wxTimePickerCtrl',
 886     'wxTimer',
 887     'wxTimerEvent',
 888     'wxTimerRunner',
 889     'wxTimeSpan',
 890     'wxTipProvider',
 891     'wxTipWindow',
 892     'wxToggleButton',
 893     'wxToolBar',
 894     'wxToolBarToolBase',
 895     'wxToolbook',
 896     'wxToolTip',
 897     'wxTopLevelWindow',
 898     'wxTrackable',
 899     'wxTransform2D',
 900     'wxTranslations',
 901     'wxTranslationsLoader',
 902     'wxTreebook',
 903     'wxTreeCtrl',
 904     'wxTreeEvent',
 905     'wxTreeItemData',
 906     'wxTreeItemId',
 907     'wxTreeListCtrl',
 908     'wxTreeListEvent',
 909     'wxTreeListItem',
 910     'wxTreeListItemComparator',
 911     'wxTwoFingerTapEvent',
 912     'wxUIActionSimulator',
 913     'wxUIntProperty',
 914     'wxULongLong',
 915     'wxUniChar',
 916     'wxUniCharRef',
 917     'wxUpdateUIEvent',
 918     'wxURI',
 919     'wxURL',
 920     'wxURLDataObject',
 921     'wxUString',
 922     'wxValidator',
 923     'wxVarHScrollHelper',
 924     'wxVarHVScrollHelper',
 925     'wxVariant',
 926     'wxVariantData',
 927     'wxVariantDataCurrency',
 928     'wxVariantDataErrorCode',
 929     'wxVariantDataSafeArray',
 930     'wxVarScrollHelperBase',
 931     'wxVarVScrollHelper',
 932     'wxVector<',
 933     'wxVersionInfo',
 934     'wxVideoMode',
 935     'wxView',
 936     'wxVisualAttributes',
 937     'wxVListBox',
 938     'wxVScrolledWindow',
 939     'wxWCharBuffer',
 940     'wxWeakRef<',
 941     'wxWeakRefDynamic<',
 942     'wxWebKitBeforeLoadEvent',
 943     'wxWebKitCtrl',
 944     'wxWebKitNewWindowEvent',
 945     'wxWebKitStateChangedEvent',
 946     'wxWebView',
 947     'wxWebViewArchiveHandler',
 948     'wxWebViewEvent',
 949     'wxWebViewFactory',
 950     'wxWebViewFSHandler',
 951     'wxWebViewHandler',
 952     'wxWebViewHistoryItem',
 953     'wxWindow',
 954     'ChildrenRepositioningGuard',
 955     'wxWindowCreateEvent',
 956     'wxWindowDC',
 957     'wxWindowDestroyEvent',
 958     'wxWindowDisabler',
 959     'wxWindowModalDialogEvent',
 960     'wxWindowPtr<',
 961     'wxWindowUpdateLocker',
 962     'wxWithImages',
 963     'wxWizard',
 964     'wxWizardEvent',
 965     'wxWizardPage',
 966     'wxWizardPageSimple',
 967     'wxWrapperInputStream',
 968     'wxWrapSizer',
 969     'wxXLocale',
 970     'wxXmlAttribute',
 971     'wxXmlDoctype',
 972     'wxXmlDocument',
 973     'wxXmlNode',
 974     'wxXmlResource',
 975     'wxXmlResourceHandler',
 976     'wxXPMHandler',
 977     'wxZipClassFactory',
 978     'wxZipEntry',
 979     'wxZipInputStream',
 980     'wxZipNotifier',
 981     'wxZipOutputStream',
 982     'wxZlibInputStream',
 983     'wxZlibOutputStream',
 984     'wxZoomGestureEvent'
 985 ]
 986 
 987 #---------------------------------------------------------------------------
 988 
 989 class MyClassCompleterSimple(wx.TextCompleterSimple):
 990     def __init__(self, maxResults=25):
 991         wx.TextCompleterSimple.__init__(self)
 992         self._iMaxResults = maxResults
 993 
 994     def GetCompletions(self, prefix):
 995         if len(prefix) < 3:
 996             return []
 997         res = []
 998         prfx = prefix.lower()
 999         for item in szClasses:
1000             if item.lower().startswith(prfx):
1001                 res.append(item)
1002                 # Max number of results reached ?
1003                 if len(res) == self._iMaxResults:
1004                     return res
1005 
1006         return res
1007 
1008 #---------------------------------------------------------------------------
1009 
1010 class MyClassCompleter(wx.TextCompleter):
1011     def __init__(self):
1012         wx.TextCompleter.__init__(self)
1013         self._iLastReturned = wx.NOT_FOUND
1014         self._sPrefix = ''
1015 
1016     def Start(self, prefix):
1017         self._sPrefix = prefix.lower()
1018         self._iLastReturned = wx.NOT_FOUND
1019         for item in szClasses:
1020             if item.lower().startswith(self._sPrefix):
1021                 return True
1022         # Nothing found
1023         return False
1024 
1025     def GetNext(self):
1026         for i in range(self._iLastReturned+1, len(szClasses)):
1027             if szClasses[i].lower().startswith(self._sPrefix):
1028                 self._iLastReturned = i
1029                 return szClasses[i]
1030         # No more corresponding item
1031         return ''
1032 
1033 #---------------------------------------------------------------------------
1034 
1035 class MyMainFrame(wx.Frame):
1036 
1037     def __init__(self):
1038         wx.Frame.__init__(self, None, title=wx.GetApp().GetAppName())
1039         self.SetIcon(wx.Icon('wxwin.ico'))
1040 
1041         self._createControls()
1042 
1043         self._connectControls()
1044 
1045     def _createControls(self):
1046         # A Statusbar in the bottom of the window
1047         self.CreateStatusBar(1)
1048         sMsg = 'wxPython ' + wx.version()
1049         self.SetStatusText(sMsg)
1050 
1051         # Add a panel to the frame (needed under Windows to have a nice background)
1052         pnl = wx.Panel(self, wx.ID_ANY)
1053 
1054         szrMain = wx.BoxSizer(wx.VERTICAL)
1055         szrMain.AddSpacer(5)
1056 
1057         stbSzr = wx.StaticBoxSizer(wx.VERTICAL, pnl, 'wxTextCompleterSimple :')
1058         stBox = stbSzr.GetStaticBox()
1059         label = wx.StaticText(stBox, wx.ID_STATIC, 'Start entering a wxWidgets class name in the wxTextCtrl below.')
1060         stbSzr.Add(label, 0, wx.LEFT|wx.RIGHT|wx.TOP, 5)
1061         stbSzr.AddSpacer(2)
1062         label = wx.StaticText(stBox, wx.ID_STATIC, 'Auto-completion should start working at the 3rd char.')
1063         stbSzr.Add(label, 0, wx.LEFT|wx.RIGHT|wx.BOTTOM, 5)
1064         self._txtEntry1 = wx.TextCtrl(stBox, -1, wx.EmptyString)
1065         stbSzr.Add(self._txtEntry1, 0, wx.LEFT|wx.RIGHT|wx.BOTTOM|wx.EXPAND, 5)
1066 
1067         szrMain.Add(stbSzr, 0, wx.LEFT|wx.RIGHT|wx.BOTTOM|wx.EXPAND, 5)
1068 
1069         stbSzr = wx.StaticBoxSizer(wx.VERTICAL, pnl, 'wxTextCompleter :')
1070         stBox = stbSzr.GetStaticBox()
1071         label = wx.StaticText(stBox, wx.ID_STATIC, 'Start entering a wxWidgets class name in the wxTextCtrl below.')
1072         stbSzr.Add(label, 0, wx.LEFT|wx.RIGHT|wx.TOP, 5)
1073         stbSzr.AddSpacer(2)
1074         label = wx.StaticText(stBox, wx.ID_STATIC, 'Auto-completion should start working at the 1rst char.')
1075         stbSzr.Add(label, 0, wx.LEFT|wx.RIGHT|wx.BOTTOM, 5)
1076         self._txtEntry2 = wx.TextCtrl(stBox, -1, wx.EmptyString)
1077         stbSzr.Add(self._txtEntry2, 0, wx.LEFT|wx.RIGHT|wx.BOTTOM|wx.EXPAND, 5)
1078 
1079         szrMain.Add(stbSzr, 0, wx.LEFT|wx.RIGHT|wx.BOTTOM|wx.EXPAND, 5)
1080 
1081         pnl.SetSizer(szrMain)
1082         szrMain.SetSizeHints(self)
1083 
1084         self._txtEntry1.AutoComplete(MyClassCompleterSimple())
1085         self._txtEntry2.AutoComplete(MyClassCompleter())
1086 
1087     def _connectControls(self):
1088         # No event handler to bind for this snippet
1089         pass
1090 
1091 #---------------------------------------------------------------------------
1092 
1093 class MyApp(wx.App):
1094     def OnInit(self):
1095         print('Running wxPython ' + wx.version())
1096         # Set Current directory to the one containing this file
1097         os.chdir(os.path.dirname(os.path.abspath(__file__)))
1098 
1099         self.SetAppName('AutoComplete')
1100 
1101         # Create the main window
1102         frm = MyMainFrame()
1103         self.SetTopWindow(frm)
1104 
1105         frm.Show()
1106         return True
1107 
1108 #---------------------------------------------------------------------------
1109 
1110 if __name__ == '__main__':
1111     app = MyApp()
1112     app.MainLoop()


Download source

source.zip


Additional Information

Link :

https://pypi.org/project/wxautocompletectrl/

https://stackoverflow.com/questions/9434063/auto-completion-feature-for-wxpython-widgets-similar-to-ajax

https://stackoverflow.com/questions/50978627/combobox-with-autocomplete-wxpython

- - - - -

https://wiki.wxpython.org/TitleIndex

https://docs.wxpython.org/


Thanks to

Xaviou (sample_one.py coding).


About this page

Date Person (bot) Comments :

14/03/18 - Ecco (Created page for wxPython Phoenix).


Comments

- blah, blah, blah...

Text control with autocomplete (Phoenix) (last edited 2019-06-05 15:29:29 by Ecco)

NOTE: To edit pages in this wiki you must be a member of the TrustedEditorsGroup.