focus problem with full-screen in Tkinter
Kevin Cazabon
kevin at cazabon.com
Mon Jul 14 18:00:58 EDT 2003
Wouldn't you have to do the bind as:
root.bind("q",lambda e: root.destroy())
I don't know if <q> evaluates to the same thing, but I know that
"normal" keys are not normally enclosed in <>. It may or may not be
part of your problem.
Kevin.
mis6 at pitt.edu (Michele Simionato) wrote in message news:<2259b0e2.0307140746.46cf2e8c at posting.google.com>...
> I have a problem with full screen windows in Tkinter.
> Here is a minimal script showing the problem:
>
> from Tkinter import *
> root=Tk()
> w, h = root.winfo_screenwidth(), root.winfo_screenheight()
> root.geometry("%dx%d+0+0" % (w, h))
> #root.overrideredirect(1)
> root.focus()
> root.bind("<q>",lambda e: root.destroy())
> root.bind("<1>",lambda e: root.destroy())
> root.mainloop()
>
> Here everything works, and if I press "q" the window is destroyed.
> However, if I uncomment the line with "overrideredirect" and I
> really go full screen, Tkinter does not recognize the keybindings
> and I cannot close the window with "q". Fortunately, the mouse
> is recognized and I can close the window with a click.
>
> I guess the problem is with the focus, how should I modify root.focus()
> to ensure that the keybindings are recognized?
>
> TIA,
>
> Michele
>
> P.S. I am using Python 2.2 on Red Hat 7.3
More information about the Python-list
mailing list