4
Contributors
6
Replies
8
Views
10 Years
Discussion Span
Last Post by sneekula
0

Hi!

root = Tk()

w, h = root.winfo_screenwidth(), root.winfo_screenheight()
# use the next line if you also want to get rid of the titlebar
root.overrideredirect(1)
root.geometry("%dx%d+0+0" % (w, h))

Regards, mawe

0

Thanks mawe, that works well.

Just a question, if get rid of the titlebar, how can I exit the program?

0

Thanks mawe, that works well.

Just a question, if get rid of the titlebar, how can I exit the program?

You need to at Exit to your menu or add an exit button.

0

To exit, you can also use a key-binding. Look:

import Tkinter as tk

def exit(event):
    root.quit()

root = tk.Tk()
tk.Label(text="Press <ESC> to exit").pack()
root.bind("<Escape>", exit)
root.mainloop()

Just press the Esc-Key and ... that's it ;)

0

To exit, you can also use a key-binding. Look:

import Tkinter as tk
 
def exit(event):
    root.quit()
 
root = tk.Tk()
tk.Label(text="Press <ESC> to exit").pack()
root.bind("<Escape>", exit)
root.mainloop()

Just press the Esc-Key and ... that's it ;)

Thanks, that works well.

Just a question, when do you use root.quit() and root.destroy()? I have seen them both.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.