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)
Related
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.
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.
I am making a UI using tkinter in python. I want to make a full screen window for my UI, without any titles or border like an undecorated frame in Java. As described on http://effbot.org/tkinterbook/wm.htm I used
root.overrideredirect(True)
It works fine and I have an full screen window, but I can't close this window using normal close operation like ALt+F4 unlike undecorated frames in Java. I need to add a functionality to close my overrideredirect window using keyboard Alt+F4 keys. How can I do that?
If not possible to add that functionality, can I use an another way to make a full screen window using any other command such that I have close with Alt+F4 keys functionality
For me Alt+F4 works fine for an undecorated window, so i'm not sure what's going wrong for you.
That being said, you can of course make a button which destroys the window. This is probably best any way, since not everyone is familiar with (simple) keyboard shortcuts.
self.button_quit = Tk.Button(self.root, text='Quit', command=self.quit).pack
def quit(self):
self.root.destroy()
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++
I use gtk.EntryCompletion to implement the autocomletion function.
But the list is so long that the pop-up window touches the bottom of screen.
And I cant find the method of set the height of pop-up window in doc of pygtk.
How to set the height of pop-up window in gtk.EntryCompletion?
I don't know if this applies to gtk.EntryCompletion widgets, but for cell like widgets you can control their height with the cell.set_fixed_height_from_font(True) method.
Look at the gtk.CellRendererText API for details.
Maybe you can solve the problem using gtk.EntryCompletion.set_minimum_key_length to prevent long list of suggestions.