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

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

import new

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 _top37, _w37
    _top37 = root
    _w37 = new.Window_I(_top37)
    # Creates a toplevel widget.
    #global _top38, _w38
    #_top38 = tk.Toplevel(root)
    #_w38 = new.Window_II(_top38)
    root.mainloop()

import time

def start2(*args):
    print('new_support.start2')
    sys.stdout.flush()
    # Creates a toplevel widget.
    global _top38, _w38
    _top38 = tk.Toplevel(root)
    _w38 = new.Window_II(_top38)
    _w38.greeting.set('Greetings')
    init(_top38, _w38)

def init(top, gui, *args, **kwargs):
    global w, top_level, root
    w = gui
    top_level = top
    root = top
    _w38.t.set(100)
    w.Button3.configure(state='disable')

def hide(*args):
    print('w2_support.hide')
    sys.stdout.flush()
    global _top37, w
    _top37.withdraw()       # Causes the first toplevel to disappear.
    w.Button3.configure(state='active')
    w.Button2_1.configure(state='disabled')

def show(*args):
    print('w2_support.show')
    sys.stdout.flush()
    global _top37, w
    _top37.deiconify()      # Causes the first toplevel to reappear.
    w.Button3.configure(state='disabled')
    w.Button2_1.configure(state='active')

def close(*args):
    print('w2_support.close')
    sys.stdout.flush()
    w.greeting.set('Goodbye')
    for i in reversed(range(10)):
        j = i * 10
        w.t.set(j)
        top_level.update()
        time.sleep(0.1)
    # Quit if Window_I is hidden.
    if _top37.winfo_viewable() == 0:
        quit()
    top_level.withdraw()   # top_level disappears but is not destroyed.

def quit(*args):
    print('new_support.quit')
    sys.stdout.flush()
    sys.exit()

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




