Python top window not minimize able with grab_set()

251 views Asked by At

I have a problem that my top window is not minimize able when i use a grab_set() on the main window.

Here is a code example:

import Tkinter as tk

class mainApView(tk.Frame):
    def __init__(self, master):
        tk.Frame.__init__(self,master)
        self.master = master
        self.master.title("Mainwindow")
        self.master.geometry("300x100")

        self.frame = tk.Frame(self.master)

        self.button = tk.Button(self.frame,text="create top level", command=self.createTopLevel)
        self.button.pack()

        self.frame.pack()

    def createTopLevel(self):
        popupWindow = tk.Toplevel(self.master)

        # this function disables the minimize button
        self.master.grab_set() 
        newTopLevel(popupWindow)

class newTopLevel():
    def __init__(self,master):
        self.master = master
        self.master.title("New Top Level Window")
        self.master.geometry("300x100")

        self.frame = tk.Frame(self.master)

        self.button = tk.Button(self.frame, text="useless button")
        self.button.pack()

        self.frame.pack()

def main():
    root = tk.Tk()
    app = mainApView(root)
    root.mainloop()

if __name__ == '__main__':
    main()

Is there a workaround? Or are the similar functions like grab_set? Or how can i override the minimize button?

EDIT My goal is that the minimize button from the top window works and the mainwindow is disabled

0

There are 0 answers