Tkinter Window On Top

Discussion in 'Python' started by Trevor, May 15, 2009.

  1. Trevor

    Trevor Guest

    Can a Tkinter application create a COM object and keep its own window
    on top of it?

    excel = win32com.client.Dispatch('Excel.Application')

    I would like the user to be able to see and interact with the Excel
    application but keep the Tkinter application on top.
    Trevor, May 15, 2009
    #1
    1. Advertising

  2. En Fri, 15 May 2009 16:39:41 -0300, Trevor <>
    escribió:

    > Can a Tkinter application create a COM object and keep its own window
    > on top of it?
    >
    > excel = win32com.client.Dispatch('Excel.Application')
    >
    > I would like the user to be able to see and interact with the Excel
    > application but keep the Tkinter application on top.


    I don't know how to do that directly with tk, but I'd use the SetWindowPos
    function: http://msdn.microsoft.com/en-us/library/ms632673(VS.85).aspx
    The tricky part is to get the right hwnd, this seems to work:

    >>> root = Tkinter.Tk()
    >>> hwnd = int(root.wm_frame(),0)
    >>> win32gui.SetWindowPos(hwnd,

    .... win32con.HWND_TOPMOST,
    .... 0,0,0,0,
    .... win32con.SWP_NOMOVE | win32con.SWP_NOSIZE)

    --
    Gabriel Genellina
    Gabriel Genellina, May 16, 2009
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?RHVzdGluIElJLg==?=

    make a browser window stay on top window handle?

    =?Utf-8?B?RHVzdGluIElJLg==?=, Aug 18, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    871
    Mark Rae
    Aug 18, 2004
  2. Frederic HOUDE
    Replies:
    4
    Views:
    594
    Frederic HOUDE
    Aug 31, 2004
  3. Ralf
    Replies:
    2
    Views:
    1,014
  4. Replies:
    1
    Views:
    700
  5. find clausen

    window.opener.top.location.top.close ???

    find clausen, Oct 5, 2003, in forum: Javascript
    Replies:
    2
    Views:
    433
    find clausen
    Oct 5, 2003
Loading...

Share This Page