Python/Tkinter - problem with "wm_attributes"

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

    Python/Tkinter - problem with "wm_attributes"

    Greetings to all experts.

    I'm running Python 2.3/Pythonwin 1.63 on Windows 98. I would like to
    create a window with Tkinter, that is always on top of the screen.

    In Tkinter.py, Line 1375 f., I'm reading:
    "On Windows, ... -topmost gets or sets whether this is a topmost window
    (displays above all other windows)."

    Therefore my simple code is:

    ############### ############### ###
    # topmost.pyw
    from Tkinter import *
    root = Tk()
    root.wm_attribu tes("-topmost", 1)
    root.mainloop()
    ############### ############### ###

    Started in IDLE (without the last line), the script runs successful.

    Started in Pythonwin or executed from the Windows Explorer, it seems to
    run endless, nothing happens, no window appears.

    Other settings of attributes (-disabled, -toolwindow) failed in
    the same way.

    What do I have failed to notice?

    Thanks for your help,

    george

  • Jason Harper

    #2
    Re: Python/Tkinter - problem with "wm_attrib utes"

    george wrote:[color=blue]
    > ############### ############### ###
    > # topmost.pyw
    > from Tkinter import *
    > root = Tk()
    > root.wm_attribu tes("-topmost", 1)
    > root.mainloop()
    > ############### ############### ###[/color]

    This seems to work better if you do:

    root.wait_visib ility(root)

    before the wm_attributes call. I have no idea why the window never
    appears without it.
    Jason Harper

    Comment

    Working...