#!/usr/bin/env python
# Display window with toDisplayText and timeOut of the window.
from Tkinter import *
def showNotification(notificationTimeout, textToDisplay):
## Create main window
root = Tk()
Button(root, text=textToDisplay, activebackground="white", bg="white", command=lambda: root.destroy()).pack(side=LEFT)
root.update_idletasks()
# Remove window decorations
root.overrideredirect(1)
timeOut = int(notificationTimeout*1000) # Convert to ms from s
## Run appliction
root.after(timeOut,root.destroy)
root.mainloop()
上記のコードは、タイムアウト付きの通知を作成します。ただし、ウィンドウでは、通知は他のすべての現在のウィンドウの上に自動的にポップアップしません。kill ボタン (テキスト) をクリックして、最初にフォーカスする必要があります。その後、ルート ウィンドウが他のすべてのウィンドウの上に表示されます。
ウィンドウ上で、通知を他のすべてのウィンドウの上に自動的に表示する方法はありますか?
Linuxで問題なく動作するようです(ubuntu 9.10)。