Tkinter Toplevel Window Cannot Be Minimized

Hi,
I am very new to Tkinter and have an issue I don’t understand. I am creating an app and create a window with root = tk.Tk() with an associated root.mainloop() in my main file. Within this loop I call a function which itself creates a second window using edit_window = tk.Toplevel(root).
When the function is located in the same file as root all works fine. But when the function is located in another file (module) then the second window has a problem. It cannot be minimized using the “_” icon in the title bar. The max icon and close icons work just fine.

Does anyone have any suggestions?

Thanks.

Code from main file:


import tkinter as tk
from tkinter import Menu

from Test_Class import DisplayData
from Test_Edit import edit_dive

# Root Window
root = tk.Tk()
root.geometry('1000x565')
root.title('Logbook')

menubar = Menu(root)
root.config(menu=menubar)

dive_menu = Menu(menubar, tearoff=0)
dive_menu.add_command(label='Edit', command = lambda : edit_dive(root))
menubar.add_cascade(label="Dive", menu=dive_menu)

windowframe = tk.Frame(root, height=550, width=980)
windowframe['borderwidth'] = 3
windowframe['relief'] = 'solid'

DisplayData.divedatebox = tk.Text(windowframe, height=1, width=30, font=("AcPlus IBM VGA 9x14", 14), bd=2, relief="sunken")
DisplayData.divedatebox.pack(side="top")

DisplayData.divetimebox = tk.Text(windowframe, height=1, width=30, font=("AcPlus IBM VGA 9x14", 14), bd=2, relief="sunken")
DisplayData.divetimebox.pack(side="top")

windowframe.pack(side="top")
windowframe.propagate(0)

root.mainloop()

Code from second file

import tkinter as tk


def edit_dive(root):

    def save_new_data():    
        edit_window.destroy()

    edit_font = "AcPlus IBM VGA 9x14"
    edit_bg = "#c5c9c7" #xkcd:silver
    edit_button_fg = "black"
    edit_button_bg = "#d1b26f"  #xkcd:tan

    edit_window = tk.Toplevel(root)
    edit_window.title("Edit Dive")
    edit_window.geometry("900x615")
    edit_window['background'] = edit_bg
    edit_window.focus_set()
    edit_window.grab_set()
    

    ewindowframe = tk.Frame(edit_window, height=595, width=880)
    ewindowframe['borderwidth'] = 3
    ewindowframe['relief'] = 'solid'
    ewindowframe['background'] = edit_bg


    ebuttonok = tk.Button(ewindowframe, text = "OK", font=(edit_font, 14),
                    fg=edit_button_fg, bg=edit_button_bg,
                    activebackground=edit_button_bg,
                    height =1,
                    width = 4,
                    command=save_new_data)

    ebuttoncancel = tk.Button(ewindowframe, text = "Cancel", font=(edit_font, 14),
                    fg=edit_button_fg, bg=edit_button_bg,
                    activebackground=edit_button_bg,
                    height =1,
                    width = 8,
                    command=edit_window.destroy)


    ewindowframe.pack(side="top")
    ewindowframe.propagate(0)
    ebuttonok.pack(side="left")
    ebuttoncancel.pack(side="right")

    edit_window.mainloop()  

Code from import file Test_Class just contains a class as follows:

class DisplayData:
    divedatebox = ""
    divetimebox = ""