#! /usr/bin/env python
#
# Support module generated by PAGE version 4.10
# In conjunction with Tcl version 8.6
#    Jan 26, 2018 01:33:27 AM


import sys

try:
    from Tkinter import *
except ImportError:
    from tkinter import *

try:
    import ttk
    py3 = 0
except ImportError:
    import tkinter.ttk as ttk
    py3 = 1

def set_Tk_var():
    global tch64
    global tch64_var
    tch64 = StringVar()
    tch64_var = IntVar(0)

def button_press(event):

    widget = event.widget

    element = widget.identify(event.x, event.y)

    if "close" in element:
        index = widget.index("@%d,%d" % (event.x, event.y))
        widget.state(['pressed'])
        widget._active = index

def button_release(event):

    widget = event.widget

    if not widget.instate(['pressed']):
            return

    element = widget.identify(event.x, event.y)

    try:
        index = widget.index("@%d,%d" % (event.x, event.y))
    except TclError:
        pass

    if "close" in element and widget._active == index:
        widget.forget(index)
        widget.event_generate("<<NotebookTabClosed>>")

    widget.state(["!pressed"])
    widget._active = None

def mouse_over(event):

    widget = event.widget
    element = widget.identify(event.x, event.y)

    if "close" in element:
        widget.state(['alternate'])

    else:
        widget.state(['!alternate'])

def init(top, gui, *args, **kwargs):
    global w, top_level, root
    w = gui
    top_level = top
    root = top

def destroy_window():
    # Function which closes the window.
    global top_level
    top_level.destroy()
    top_level = None

if __name__ == '__main__':
    import GUI
    GUI.vp_start_gui()


