#! /usr/bin/env python
#  -*- coding: utf-8 -*-
#
# Support module generated by PAGE version 7m
#  in conjunction with Tcl version 8.6
#    Aug 08, 2021 09:47:28 PM PDT  platform: Linux

#-------------------------------------------------------------------------------
# An autocompleting combobox widget incorporated into PAGE as a custom control,
# with a PAGE alias of cmbTest. The new widget is in the ttkwidgets package,
# which was installed by :
#   pip install ttkwidgets
# Website : https://ttkwidgets.readthedocs.io/en/latest/installation.html
#
# (this is just one of many additional widgets in the package)
#-------------------------------------------------------------------------------

import sys
import tkinter as tk
import tkinter.ttk as ttk
from tkinter.constants import *

# Import the autocompletion combobox from the widgets package.
from ttkwidgets.autocomplete import AutocompleteCombobox as auto

import Autocomplete

def main(*args):
    '''Main entry point for the application.'''
    global root
    root = tk.Tk()
    root.protocol( 'WM_DELETE_WINDOW' , root.destroy)
    # Creates a toplevel widget.
    global _top44, _w44
    _top44 = root
    _w44 = Autocomplete.Toplevel1(_top44)
    init(_top44, _w44)
    root.mainloop()

#-------------------------------------------------------------------------------

def init(top, gui, *args, **kwargs):
    global w, top_level, root
    w = gui
    top_level = top
    root = top
#    global vtxtValue
#    vtxtValue = tk.StringVar()

    # Some data to use for the dropdown...
    temp = ["Opening Balance","Tesco Current Account","Amazon UK","Bridgend Industrial Estate",
    "Whittard Of Chelsea","Canada Life Annuity 1","Domestic And General","NHS Pension","Aldermore Bank Plc",
    "Interest Added","National Magazine","Manweb","Bridgend County Council","Barclaycard","Tesco",
    "State Pension","Wilsons (Bridgend) Ltd","Canada Life Annuity 2","British Telecom","Welsh Water",
    "TV Licence","The Wildlife Trust Of South Wales","Tesco Clubcard","Action Aid",
    "Appliance Spares Warehouse","Argos","Text Aloud","David And Snape Solicitors","Green Flag",
    "Healthspan","Screwfix","Hastings Direct","Blinkbox","Gizmo Heaven","Millets","Orange","Acronis",
    "Paramo","Alpha Travel Insurance","Interest Earned","Student Subscription Service","Astronomy Now",
    "The Metal Store","B&Q","QuoteMeHappy.com","Crucial.com","Museum Selection","Cash Withdrawal",
    "Marks & Spencer","Vale Resort","All Iceland Ltd","Visual Micro","EBay","Laithwaites","VirTronics",
    "Anquet Maps","National Savings & Investments","Dental Surgery","MoneyCorp","My Memory (Via PayPal)",
    "Showcase Cinema","Scottish Power","Acorn Lodge Hotel","Torch Direct (via PayPal)","IO Astronomy",
    "MPB Photographic","British Astronomical Association","Halifax Clarity","Altair Astro",
    "Ramblers Holidays","Corel","GipsyMedia","HF Holidays","Audials","Kobo","Lanzak Ltd","Printhead Hospital",
    "TrainLine","DVLC","CyberGhost","Ebuyer.com","Appliance Spares","Netflix","Wikipedia",
    "Monk Coniston Hotel","Castle Insurance","Treloyhan Manor Hotel","Purple Parking","Saga",
    "Axa Insurance","Easy Life Group","Jenson Corporation (via Amazon)","Earth Heritage Trust",
    "Currys PC World","EE","Bodykind","Ikea","OfficialCarMats.com","HM Courts And Tribunals Service",
    "Winter Fuel Allowance","Harts Of Stur","MyMemory","Paypal / ebay","MPN Windows"]

    # Load the data to the custom control
    w.cmbTest.set_completion_list(temp)
    w.vtxtValue.set('')

#-------------------------------------------------------------------------------

def btnGetValue_Click(*args):
    global vtxtValue
    # Display the value selected in the custom control
    w.vtxtValue.set(w.cmbTest.get())


#-------------------------------------------------------------------------------


Custom = tk.Frame  # To be updated by user with name of custom widget.
Custom = auto

if __name__ == '__main__':
    Autocomplete.start_up()




