[Tkinter-discuss] Re: Tkinter screen saver?
fredrik at pythonware.com
Mon Oct 11 22:37:41 CEST 2004
Roland Kwee wrote:
>I am not making a screen saver, but a photo viewer.
> While overrideredirect(1) is great for going fullscreen,
> it doesn't seem possible to bind a keyboard event, e.g.,
> to go to the next photo, or exit fullscreen mode.
> It seems that only mouse events work with overrideredirect(1),
> but then I need to display a button.
> How can we make, say, the escape button end fullscreen mode?
make sure the widget has focus:
from Tkinter import *
root = Tk()
w, h = root.winfo_screenwidth(), root.winfo_screenheight()
root.geometry("%dx%d+0+0" % (w, h))
root.focus_set() # <-- move focus to this widget
root.bind("<Escape>", lambda e: e.widget.quit())
More information about the Tkinter-discuss