![]() |
Custom Window Decorations on all Windows - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: Custom Window Decorations on all Windows (/thread-43987.html) |
Custom Window Decorations on all Windows - Beenman11 - Feb-10-2025 Hi, I am making a Helping Script for a game, which uses tkinter for the GUI elements and messagebox for a pop up window. For this script, there is a custom window decoration, called HackerWindowDecorator. I applied this window decoration to the main window of the script, and it worked without problems, however, i cant get it to work on the pop up window, called RoundSetupDialog. First thing i tried was adding the decorator in the windows class (L.14: "self.decorator = HackerWindowDecorator(self.top)" ), like i did with the main window (L. 133: "self.decorator = HackerWindowDecorator(self.root)" ), but when i do that, although the window decorations do seem to apply, the windows proportions and gui elements are messed up and the window goes behind all other windows, so i always have to go to the desktop to see it. I also cant interact with the window anymore. That is about the only approach that gave me some progress, everything else did not change the windows decoration at all or messed up the code completely, with error messages or other strange things. Apart from that, I did not get any strange error messages or glitches, but i also couldnt find any help on the web on how i could do it correctly. Essentialy, I am just asking for how to apply the window decoration to the second window, and it could be that i am missing something really obvious here. Note: - I attached the whole script to the thread - Most of the Script was made by the claude AI, since i dont have this much time for such a project. RE: Custom Window Decorations on all Windows - deanhystad - Feb-11-2025 Your problems are related to these lines in RoundSetupDialog. When I comment out both lines it appears to work correctly. self.top.transient(parent) self.top.grab_set()self.top.grab_set() reroutes all events to top. That means button and move events do not go to the decorator. grab_set() should only be used for things like the Ok button on a modal dialog. self.top.transient(parent) sets instructions to the window manager to treat top as a transient window. Your decorator appears to be trying to replace the window manager, so I can see why there may be a conflict. RE: Custom Window Decorations on all Windows - Beenman11 - Feb-11-2025 (Feb-11-2025, 04:46 AM)deanhystad Wrote: Your problems are related to these lines in RoundSetupDialog. When I comment out both lines it appears to work correctly. That seems to work ![]() Thanks a lot for your help :) RE: Custom Window Decorations on all Windows - deanhystad - Feb-11-2025 I can move the windows if I comment out both lines. One thing I did notice is that you cannot click on the title_label and drag the window. You have to click between the label and close button. This is easily fixed by packing the title_label to expand and fill, and then binding button and motion events int the title_label, not the titlebar. |