Add button to Tkinter Window panel before minimise, maximise buttons - python

I have developed a Tkinter GUI and need to add a button in the GUI window top panel, next to the minimise, maximise and close buttons. The button then calls a function. How can this be done?

Tkinter doesn't have any support to do what you want. You'll have to find some sort of platform-specific library to alter what is shown in the window border.
Your only other option is to turn off the window border provided by your OS with overrideredirect, and then create your own border with whatever controls you want. This requires a lot of work because you also have to write the code for moving and resizing the window, but it's possible.

Related

how to make tkinter window not moveable with the mouse

very simple problem, I just try to make tkinter window that you are not able to move with the mouse. the problem is that I don't find a function that can do it, the only thing that I found is making it not resizable and stuff like that, I also found a function that hides the bar and making it not resizable or moveable, but it doesn't help me cause I still want it to have the default window bar, let's just say I have a normal window here:
import tkinter as TK
window = TK.Tk()
window.geometry('1200x800')
window.mainloop()
so just tell me if you know how to make it impossible to move the window with the mouse, how to do that, the code should work fine with fullscreen and other functionality like that by the way.

Python tkinter keeping window on top when focusing on another window

I'm making a text editor, and I have made a find/replace function with it's own window.
It looks like this. I want it to become transparent when changing back to the main text window, but stay there. (Like what notepad++ does).
As you can see here, the find window is in front of the main window but it is transparent.
I already know I can use this to make the window transparent:
find_window.attributes('-alpha', 0.3)
But now I want it to stay on top while the focus is on the other window.
I have figured it out myself. I had to use the focus_out event and then use .lift() to place it on top:
def leave():
find_window.attributes('-alpha', 0.3)
find_window.lift()
find_window.bind('<FocusOut>', leave)

How can create popup menu(window) as in the picture pyqt4

How can I create such a pop up window as shown in the image below? What libraries are available for the implementation of such a task?
Important things are:
The triangle at the top of the popup menu
Shadows around the window
The alignment of the window under the call button
Python (pyqt4)

Python/Tkinter: Apply .attributes() method to Frame vs. Window?

Does Tkinter or underlying Tk framework support the ability to apply the equivalent of the attributes() method to Frames vs. Windows?
Specifically: I have forms with a message area that I would like to fade away in jquery-like manner, eg. display a non-modal status message that fades away. I know I can fade a Tkinter window via window.attributes("-alpha", alpha), but I don't see an equivalent way to achieve this effect with a Frame. (I know I could place a top-level message window over my dialog, but coordinating the position and size of this window to match the layout of my dialog sounds complicated).
No, there is no way to do what you want. Tkinter only supports transparency on top-level windows.

How do I get a windows border like this in Tkinter?

Is there any way to get a border like this in Tkinter? Notice how it lacks the buttons on the top right. Also I don't want this program to show in the task bar.
This is in windows 7, btw.
Tk (and thus, Tkinter) has a command for removing all window manager decoration. This command in tkinter is the "wm_overrideredirect" method of toplevel windows. Pass it a parameter of True to remove the window manager decorations. You can then draw whatever borders you want, usually by packing a canvas over the entire window and drawing on the canvas.
However, when I experiment with this on my Mac, the window appears properly but won't take focus. Perhaps this is a bug in Tkinter. I don't see the same problem with identical code in Tcl.
The WS_DLGFRAME window style should give you a window without a titlebar and WS_EX_TOOLWINDOW is normally also used for a window like this so it is not visible in the taskbar (Or with a hidden parent window like control panel dialogs before Vista) You can figure out the exact window styles with a tool like Spy++ (Visual Studio) or WinSpy++

Categories

Resources