TomSchimansky / CustomTkinter

A modern and customizable python UI-library based on Tkinter
MIT License
10.77k stars 1.03k forks source link

CTkTopLevel #2483

Open mcaple opened 1 week ago

mcaple commented 1 week ago

The CTkTopLevel sample does not bring the window to the front when the button is clicked. It appears behind the main window. If you click again it will be given focus and brought to front. I am running this on Windows 11. Many thanks for this project.

TRadigk commented 1 week ago

One solution: self.after(10, lambda: self.lift())

You can play around with the value of 10 ms.

mcaple commented 1 week ago

I was toying around with using the "after" method but wanted to check as am new to the Python GUI world.

Thanks once again

mate02102003 commented 1 week ago

I have tracked down why that is the behavior. In the ctk_toplevel.py from line 275-277 on windows it gives back the focus to the widget which had the the focus before withdraw, In this case the the app created in main.

This migth have been a fix for something else when the window is already created, when you want to change the appearance of the title bar