1

There are quite a few posts on trying to push a Tkinter window on top:

... and one post (only partially about Tkinter) I found, for a window on bottom, which is what I'm interested in:

... however, here I'd like to open a Tkinter window below the current terminal window - say I open a terminal, and run the Python shell there:

$ python2.7
Python 2.7.1+ (r271:86832, Sep 27 2012, 21:16:52) 
[GCC 4.5.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import Tkinter as tk
>>> root = tk.Tk()
>>> str(root)
'.'
>>> root.tk.eval('wm stackorder '+str(root))
'.'
>>> root.lower()

When I enter root.lower() (very carefully, so the window remains on top, while I'm pressing the Enter key), I cannot see any changes in the window stacking order on the desktop (that is, the window simply remains on top).

Now, from what I can see from wm stackorder, Tkinter probably only keeps track of its own windows - not the terminal window (in which Python itself runs), which would be handled by the window manager proper; is that correct? (I myself am using gnome-terminal on Ubuntu 11.04 Gnome)

In that case, I guess it would be unreasonable to expect that lower() would send the window at the bottom of the stacking order of desktop windows, that tkinter doesn't even know about. But is this correctly understood - is there no way to send a window "to back" from Tkinter?

Community
  • 1
  • 1
sdaau
  • 36,975
  • 46
  • 198
  • 278

1 Answers1

1

I have tried root.lift() and root.lower() in Windows 8 and Ubuntu 12.04 Unity, and they behave with the Python interpreter console as they would do with another Tkinter window. It seems it doesn't "know about" the rest of the windows which aren't created by Tkinter, but the internal system call in each lift and lower takes them into account for the order.

So it doesn't look like you could be able to access other windows with Tkinter (at least, by taking a look at the source code of the library), and this interaction with them is part of the functioning of the desktop environment.

A. Rodas
  • 20,171
  • 8
  • 62
  • 72