Created
May 14, 2013 14:17
-
-
Save TravisJoe/5576258 to your computer and use it in GitHub Desktop.
Tkinter in python full screen example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from Tkinter import * | |
root = Tk() | |
w = Label(root, text="Hello, world!") | |
root.overrideredirect(True) | |
root.geometry("{0}x{1}+0+0".format(root.winfo_screenwidth(), root.winfo_screenheight())) | |
root.focus_set() # <-- move focus to this widget | |
root.bind("<Escape>", lambda e: e.widget.quit()) | |
w.pack() | |
root.mainloop() |
simply change the quit function to this:
"lambda e: root.quit()"
import Tkinter as tk
root = tk.Tk()
root.attributes('-fullscreen', True)
root.bind('<Escape>',lambda e: root.destroy())
The last version (by yoggoy) works well with python3. Just need to add root.mainloop()
in the end to keep the app running.
hoi
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In Python 3, Tkinter has changed to tkinter (in lowercase).
In this script, the escape key don't work :(