#! /usr/bin/env python3
#  -*- coding: utf-8 -*-
#
# GUI module generated by PAGE version 8.1z
#  in conjunction with Tcl version 8.6
#    Nov 07, 2024 12:27:31 AM PST  platform: Linux

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

_location = os.path.dirname(__file__)

import three_support

_bgcolor = 'wheat'  # X11 color: #f5deb3
_fgcolor = '#000000'  # X11 color: 'black'
_tabfg1 = 'black' 
_tabfg2 = 'black' 
_bgmode = 'light' 
_tabbg1 = '#d9d9d9' 
_tabbg2 = '#b2c9f4' 

class Main:
    def __init__(self, top=None):
        '''This class configures and populates the toplevel window.
           top is the toplevel containing window.'''

        top.geometry("410x347+278+339")
        top.minsize(1, 1)
        top.maxsize(1905, 1170)
        top.resizable(1,  1)
        top.title("Main")
        top.configure(background="wheat")
        top.configure(highlightbackground="wheat")

        self.top = top

        self.Button1 = tk.Button(self.top)
        self.Button1.place(relx=0.317, rely=0.461, height=37, width=147)
        self.Button1.configure(activebackground="#f4bcb2")
        self.Button1.configure(background="wheat")
        self.Button1.configure(command=three_support.open_middle)
        self.Button1.configure(disabledforeground="#b8a786")
        self.Button1.configure(font="-family {DejaVu Sans} -size 14")
        self.Button1.configure(highlightbackground="wheat")
        self.Button1.configure(text='''Open Middle''')

        self.Button2 = tk.Button(self.top)
        self.Button2.place(relx=0.417, rely=0.692, height=37, width=67)
        self.Button2.configure(activebackground="#f4bcb2")
        self.Button2.configure(background="wheat")
        self.Button2.configure(command=three_support.quit)
        self.Button2.configure(disabledforeground="#b8a786")
        self.Button2.configure(font="-family {DejaVu Sans} -size 14")
        self.Button2.configure(highlightbackground="wheat")
        self.Button2.configure(text='''Quit''')

        self.Message1 = tk.Message(self.top)
        self.Message1.place(relx=0.361, rely=0.173, relheight=0.092
                , relwidth=0.237)
        self.Message1.configure(background="wheat")
        self.Message1.configure(font="-family {DejaVu Sans Mono} -size 14")
        self.Message1.configure(highlightbackground="wheat")
        self.Message1.configure(text='''Main GUI''')
        self.Message1.configure(width=90)

class Middle:
    def __init__(self, top=None):
        '''This class configures and populates the toplevel window.
           top is the toplevel containing window.'''

        top.geometry("459x315+700+341")
        top.minsize(1, 1)
        top.maxsize(1905, 1050)
        top.resizable(1,  1)
        top.title("Man in the Middle")
        top.configure(background="wheat")
        top.configure(highlightbackground="wheat")

        self.top = top

        self.Message1_1 = tk.Message(self.top)
        self.Message1_1.place(relx=0.144, rely=0.159, relheight=0.371
                , relwidth=0.71)
        self.Message1_1.configure(background="wheat")
        self.Message1_1.configure(font="-family {DejaVu Sans} -size 12")
        self.Message1_1.configure(highlightbackground="wheat")
        self.Message1_1.configure(text='''This is a man-in-the-middle toplevel.

It is invoked from the main toplevel
and in turn invokes another GUI which
has a popup and therefore, needs 'root'.''')
        self.Message1_1.configure(width=326)

        self.Button1_1 = tk.Button(self.top)
        self.Button1_1.place(relx=0.196, rely=0.698, height=33, width=94)
        self.Button1_1.configure(activebackground="#f4bcb2")
        self.Button1_1.configure(background="wheat")
        self.Button1_1.configure(command=three_support.invoke)
        self.Button1_1.configure(disabledforeground="#b8a786")
        self.Button1_1.configure(font="-family {DejaVu Sans Mono} -size 14")
        self.Button1_1.configure(highlightbackground="wheat")
        self.Button1_1.configure(text='''Invoke''')

        self.Button2_1 = tk.Button(self.top)
        self.Button2_1.place(relx=0.627, rely=0.698, height=32, width=72)
        self.Button2_1.configure(activebackground="#f4bcb2")
        self.Button2_1.configure(background="wheat")
        self.Button2_1.configure(command=three_support.quit)
        self.Button2_1.configure(disabledforeground="#b8a786")
        self.Button2_1.configure(font="-family {DejaVu Sans Mono} -size 14")
        self.Button2_1.configure(highlightbackground="wheat")
        self.Button2_1.configure(text='''Quit''')

class Popup:
    def __init__(self, top=None):
        '''This class configures and populates the toplevel window.
           top is the toplevel containing window.'''

        top.geometry("420x325+1171+339")
        top.minsize(1, 1)
        top.maxsize(1905, 1170)
        top.resizable(1,  1)
        top.title("Popup")
        top.configure(background="wheat")
        top.configure(highlightbackground="wheat")

        self.top = top

        self.Message1_2 = tk.Message(self.top)
        self.Message1_2.place(relx=0.252, rely=0.092, relheight=0.28
                , relwidth=0.493)
        self.Message1_2.configure(background="wheat")
        self.Message1_2.configure(font="-family {DejaVu Sans} -size 12")
        self.Message1_2.configure(highlightbackground="wheat")
        self.Message1_2.configure(text='''Each button
has a popup menu.''')
        self.Message1_2.configure(width=207)

        self.Button3_1 = tk.Button(self.top)
        self.Button3_1.place(relx=0.364, rely=0.782, height=50, width=72)
        self.Button3_1.configure(activebackground="#f4bcb2")
        self.Button3_1.configure(background="wheat")
        self.Button3_1.configure(command=three_support.quit)
        self.Button3_1.configure(disabledforeground="#b8a786")
        self.Button3_1.configure(font="-family {DejaVu Sans Mono} -size 14")
        self.Button3_1.configure(highlightbackground="wheat")
        self.Button3_1.configure(text='''Quit''')

        self.Button1_2 = tk.Button(self.top)
        self.Button1_2.place(relx=0.169, rely=0.492, height=33, width=91)
        self.Button1_2.configure(activebackground="#f4bcb2")
        self.Button1_2.configure(background="wheat")
        self.Button1_2.configure(disabledforeground="#b8a786")
        self.Button1_2.configure(font="-family {DejaVu Sans Mono} -size 14")
        self.Button1_2.configure(highlightbackground="wheat")
        self.Button1_2.configure(text='''Button1''')
        if (three_support.root.tk.call('tk', 'windowingsystem')=='aqua'):
            self.Button1_2.bind('<Control-1>', lambda e: self. popup0(e))
            self.Button1_2.bind('<Button-3>', lambda e: self. popup0(e))
        else:
            self.Button1_2.bind('<Button-3>', lambda e: self. popup0(e))

        self.Button2_2 = tk.Button(self.top)
        self.Button2_2.place(relx=0.524, rely=0.492, height=33, width=91)
        self.Button2_2.configure(activebackground="#f4bcb2")
        self.Button2_2.configure(background="wheat")
        self.Button2_2.configure(disabledforeground="#b8a786")
        self.Button2_2.configure(font="-family {DejaVu Sans Mono} -size 14")
        self.Button2_2.configure(highlightbackground="wheat")
        self.Button2_2.configure(text='''Button2''')
        if (three_support.root.tk.call('tk', 'windowingsystem')=='aqua'):
            self.Button2_2.bind('<Control-1>', lambda e: self. popup1(e))
            self.Button2_2.bind('<Button-3>', lambda e: self. popup1(e))
        else:
            self.Button2_2.bind('<Button-3>', lambda e: self. popup1(e))

    def popup0(self, event, *args, **kwargs):
        self.Popupmenu1 = tk.Menu(self.top, activebackground='#f4bcb2'
                ,activeforeground='black', background='wheat'
                ,disabledforeground='#b8a786'
                ,font="-family {DejaVu Sans} -size 12", tearoff=0)
        self.Popupmenu1.add_command(compound='left'
                ,font="-family {DejaVu Sans} -size 12", label='This')
        self.Popupmenu1.add_command(compound='left'
                ,font="-family {DejaVu Sans} -size 12", label='That')
        self.Popupmenu1.add_command(compound='left'
                ,font="-family {DejaVu Sans} -size 12", label='But')
        self.Popupmenu1.add_separator()
        self.sub_menu0 = tk.Menu(self.Popupmenu1, activebackground='#d9d9d9'
                ,activeforeground='black', background='wheat'
                ,disabledforeground='#b8a786'
                ,font="-family {DejaVu Sans} -size 10", tearoff=0)
        self.sub_menu0.add_command(command=three_support.sys.exit, compound='left'
                ,font="-family {DejaVu Sans} -size 12", label='Exit')
        self.Popupmenu1.add_cascade(compound='left'
                ,font="-family {DejaVu Sans} -size 12", label='Maybe'
                ,menu=self.sub_menu0, )
        self.Popupmenu1.post(event.x_root, event.y_root)

    def popup1(self, event, *args, **kwargs):
        self.Popupmenu2 = tk.Menu(self.top, activebackground='#f4bcb2'
                ,activeforeground='black', background='wheat'
                ,disabledforeground='#b8a786'
                ,font="-family {DejaVu Sans} -size 12", tearoff=0)
        self.Popupmenu2.add_command(compound='left'
                ,font="-family {DejaVu Sans} -size 12", label='How')
        self.Popupmenu2.add_command(compound='left'
                ,font="-family {DejaVu Sans} -size 12", label='Now')
        self.Popupmenu2.add_separator()
        self.sub_menu1 = tk.Menu(self.Popupmenu2, activebackground='#d9d9d9'
                ,activeforeground='black', background='wheat'
                ,disabledforeground='#b8a786', tearoff=0)
        self.sub_menu1.add_command(command=three_support.sys.exit, compound='left'
                ,font="-family {DejaVu Sans} -size 12", label='Quit')
        self.Popupmenu2.add_cascade(compound='left'
                ,font="-family {DejaVu Sans} -size 12", label='Brown Cow'
                ,menu=self.sub_menu1, )
        self.Popupmenu2.post(event.x_root, event.y_root)

def start_up():
    three_support.main()

if __name__ == '__main__':
    three_support.main()




