I have a strange problem. To understand what really happened, I tried myself and googled, but no result. I simplified my code:
#mainw.py
import tkinter as tk
import modalw
class Main(tk. Frame) :
def__init__(self, master) :
tk.Frame.__init__(self, master)
self.master = master
self.btn = tk.Button(master, text='modalwin', command=self.openwin)
self.btn.pack()
def openwin(self):
mod = modalw.Modal()
#modalw.py
import tkinter as tk
class Modal(tk. Frame) :
def__init__(self, master) :
tk.Frame.__init__(self, master)
self.top = tk.TopLevel()
#I'm not sure these 3 lines of code are true
self.top.transient(master)
self.top.grab_set()
master.wait_window(self)
self.lbl = tk.Label(self.top, text='Hello')
self.lbl.pack()
self.btn2 = tk.Button(master, text='change text', command=self.change)
self.btn2.pack()
def change(self):
self.lbl.config(text='Good bye')
Problem is, after opening modal window, I minimize(iconify) all windows (pressing Ctrl+D), then when I try maximize(deiconify), both windows above isn't maximized anyway. Can somebody explain this? Is it my error or should I use other way?
This is a screen gif:
For info: my OS is Windows 7 and I checked in other PC.