Open DanDDXuanX opened 1 year ago
Hello,I had the same problem when I minimized the window and closed it in the taskbar,the window did not close and cannot be reopened.
import ttkbootstrap as ttk
from ttkbootstrap.dialogs import Messagebox
root_total= ttk.Window()
def on_closing():
T = Messagebox.show_question(message='close or not?', title="quit", buttons=["close:info", "not:secondary"],parent=root_total,position=(root_total.winfo_x() + root_total.winfo_width() // 2 - 100,root_total.winfo_y() + root_total.winfo_height() // 2 - 100))
if T == 'close':
root_total.destroy()
root_total.protocol("WM_DELETE_WINDOW", on_closing)
I made a slight modification to this part (dialog.py line 89-90), which seems to temporarily solve the issue.
However, this requires Dialog to have the parent
parameter.
if self._parent:
self._parent.winfo_toplevel().attributes("-disabled", True)
self._toplevel.wait_window()
self._parent.winfo_toplevel().attributes("-disabled", False)
self._parent.winfo_toplevel().lift()
self._parent.winfo_toplevel().focus_force()
else:
self._toplevel.grab_set()
self._toplevel.wait_window()
Desktop (please complete the following information):
ttkbootstrap: 1.10.1 OS: Windows11
Describe the bug
Hello:
I'm writing a application with ttkbootstrap, and I found a issue that I cannot fix by myself.
When a MessageBox is displayed above the root window, if I use keyboard win+D to switch to desktop, or scenarios that MessageBox show with root window minimized, root windows and the MessageBox cannot be show on screen anymore.
I think it's line 89-90 in dialog.py, in method Dialog.show, led to this problem.
if I remove
self._toplevel.grab_set()
, this issue can be fix, but the root window will not be disabled while showing a messagebox, and this can lead to a lot of misoperations.I wonder if there is a better solution here?
To Reproduce
Here I provide a small example to reproduce this issue:
after run code above, use keyboard win+D to switch to desktop, the root window cannot be reopen again.
Expected behavior
Make the minimized window with dialog can be reopen normally, without affect the performance of other functions.
Screenshots
No response
Additional context
No response