4

I have a python tkinter application which I want to run full screen. When I uncomment overrideredirect, the window manager (Gnome, Linux) will not be able to forward keystrokes to the application anymore.

(fragment, python)

# make it cover the entire screen
w, h = master.winfo_screenwidth(), master.winfo_screenheight()
self.root.geometry("%dx%d+0+0" % (w, h))
self.root.focus_set() # <-- move focus to this widget
self.root.bind('<Escape>', self.root.quit())
#self.root.overrideredirect(True)

I've found the window::or package for Tcl/Tk, which is supposed to resolve this bug. How would I go about installing this, and would it be possible to use it from within my python application?

http://www.binarism.com/tk/window/or/

http://www.binarism.com/tk/window-or-0.1.1.tgz

micschk
  • 41
  • 1
  • 3

2 Answers2

4

This works for the use case where you're using overrideredirect to get fullscreen, which is somewhat common:

#self.root.overrideredirect(1)
self.root.attributes('-fullscreen', True)
Vasiliy Sharapov
  • 997
  • 1
  • 8
  • 27
pt3
  • 61
  • 1
  • 2
  • 3
    "fullscreen" isn't the same as setting the overrideredirect attribute. – Bryan Oakley Nov 26 '12 at 00:02
  • Heads-up if you're using `overrideredirect()` or `-fullscreen` to go full-screen: the former should encompass the entire "display" - all monitors including areas that might not be on any monitor, same area that is captured with a full screenshot. The latter only takes over the screen it's on - so normally one monitor. – Vasiliy Sharapov May 08 '15 at 15:14
0

You might want to enter the callable self.root.quit instead of self.root.quit() when you do the binding to avoid calling the function. when you will press Escape the callable will be called (I know I know) with an event argument. If self.root.quit() does not accept any argument: use lambda: self.root.bind('<Escape>',lambda e:self.root.quit())

oivier
  • 1