Tkinter OSX and "lift"

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Miki

    Tkinter OSX and "lift"

    Hello,

    Tk.lift doesn't seem to work on OSX (Python 2.5.1).
    The below starts OK, but the window is the behind all other windows.

    from Tkinter import *

    root = Tk()
    Button(root, text="OK", command=root.qu it).pack()
    root.lift()
    root.mainloop()

    Any ideas how to tell the window to start as the topmost window?

    Thanks,
    --
    Miki <miki.tebeka@gm ail.com>
    If it won't be simple, it simply won't be. [Hire me, source code]

  • Kevin Walzer

    #2
    Re: Tkinter OSX and &quot;lift&quot ;

    Miki wrote:
    Hello,
    >
    Tk.lift doesn't seem to work on OSX (Python 2.5.1).
    The below starts OK, but the window is the behind all other windows.
    >
    from Tkinter import *
    >
    root = Tk()
    Button(root, text="OK", command=root.qu it).pack()
    root.lift()
    root.mainloop()
    >
    Any ideas how to tell the window to start as the topmost window?
    >
    Thanks,
    --
    Miki <miki.tebeka@gm ail.com>
    http://pythonwise.blogspot.com
    If you click on the PythonLauncher application that runs in your dock
    when this script is executed, the window comes into focus fine.

    --
    Kevin Walzer
    Code by Kevin

    Comment

    • Miki

      #3
      Re: Tkinter OSX and &quot;lift&quot ;

      Hello Kevin,
      Tk.lift doesn't seem to work on OSX (Python 2.5.1).
      >If you click on the PythonLauncher application that runs in your dock
      >when this script is executed, the window comes into focus fine.
      You're right, but I want to window to be initially in focus (without
      the user clicking on the python launcher icon).

      All the best,
      --
      Miki <miki.tebeka@gm ail.com>
      If it won't be simple, it simply won't be. [Hire me, source code]

      Comment

      • Miki

        #4
        Re: Tkinter OSX and &quot;lift&quot ;

        Hello Eric,
        >Tk.lift doesn't seem to work on OSX (Python 2.5.1).
        There is a trick that sometimes works even for interpreted application:
        >
        import Tkinter as tk
        root = tk.Tk()
        root.withdraw()
        # Code building the window...
        root.lift()
        root.deiconify( )
        root.mainloop()
        >
        This sometimes forces the window to be top-most. If this doesn't work, you 
        can also try:
        >
        import Tkinter as tk
        root = tk.Tk()
        root.withdraw()
        # Code building the window...
        root.lift()
        root.after_idle (root.deiconify )
        root.mainloop()
        >
        This was a trick that had to be done on Windows a few years back to force  
        the main window to be created on top of this others. It deosn't seem to be 
        needed anymore now, but maybe the trick can be used on a Mac... Don't know 
        if this will work the same, though...
        Sadly, both of them didn't work.

        Thanks.
        --
        Miki <miki.tebeka@gm ail.com>
        If it won't be simple, it simply won't be. [Hire me, source code]

        Comment

        Working...