Skip to content

Instantly share code, notes, and snippets.

@TravisJoe
Created May 14, 2013 14:17
Show Gist options
  • Star 9 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save TravisJoe/5576258 to your computer and use it in GitHub Desktop.
Save TravisJoe/5576258 to your computer and use it in GitHub Desktop.
Tkinter in python full screen example
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()
@Yllelder
Copy link

In Python 3, Tkinter has changed to tkinter (in lowercase).

In this script, the escape key don't work :(

@XiaochuanWang
Copy link

simply change the quit function to this:
"lambda e: root.quit()"

@yogggoy
Copy link

yogggoy commented May 8, 2018

import Tkinter as tk

root = tk.Tk()
root.attributes('-fullscreen', True)
root.bind('<Escape>',lambda e: root.destroy())

src

@leosh64
Copy link

leosh64 commented Jun 12, 2020

The last version (by yoggoy) works well with python3. Just need to add root.mainloop() in the end to keep the app running.

@1anony1mous1
Copy link

hoi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment