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

1

2 Answers 2

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)
Sign up to request clarification or add additional context in comments.

2 Comments

"fullscreen" isn't the same as setting the overrideredirect attribute.
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.
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())

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.