slyaer
slyaer

Reputation: 261

Make Tkinter window not always on top

I have a simple program as follows:

from Tkinter import *

class Run:
    def __init__(self,parent):
        parent.overrideredirect(True)

root = Tk()
app = Run(root)
root.mainloop()

When I run this program, the undecorated root window always stays on top. How can I make it so any other window can be on top of it, whilst having no decorations?

I have tried setting 'topmost' to 'False' as well, but to no avail.

I am running Ubuntu 13.04.

Thanks in advance

Upvotes: 1

Views: 1074

Answers (2)

shawn
shawn

Reputation: 341

Seems like this should happen automatically if I click a different window.

Upvotes: 1

Peter Varo
Peter Varo

Reputation: 12150

This code below, will put your window on the background on every 100ms, no matter what, so everything will be in the front of it all the time. I think this is what you were asking for:

from tkinter import *

class Run:
    def __init__(self):
        self.root = Tk()
        self.root.overrideredirect(True)
    def put_back(self):
        # this method will put the window to the background
        self.root.lower()
        # recursive calling of put_back method
        self.root.after(100, self.put_back)

app = Run()
# Start the recursion
app.put_back()
app.root.mainloop()

Upvotes: 2

Related Questions