With this test code on python 3.6.3
tkinter.Tcl().eval('info patchlevel')
returns '8.6.6'
My OS is Mint 18.3 Cinnamon 3.6.7, but I want my code to be crossplatform.
I use the console to run the script:
from tkinter import *
from tkinter import ttk
def valid(*args):
print("Dans valid", nom.get())
root.quit()
root = Tk()
rootW = 300
rootH = 200
x = (root.winfo_screenwidth() - rootW)//2
y = (root.winfo_screenheight() - rootH)//2
root.geometry(f'{rootW}x{rootH}+{x}+{y}')
mainFrame = ttk.Frame(root, padding="5")
mainFrame.grid(column=0, row=0, sticky=(N, W, E, S))
mainFrame.columnconfigure(0, weight=1)
mainFrame.rowconfigure(0, weight=1)
nom = StringVar()
nomEntry = ttk.Entry(mainFrame, width=20, textvariable=nom)
nomEntry.grid(column=2, row=2, sticky=(E))
ttk.Label(mainFrame, text="Inscription").grid(column=2, row=1, sticky=W)
ttk.Label(mainFrame, text="Votre nom").grid(column=1, row=2)
ttk.Button(mainFrame, text="Validation", command=valid).grid(column=2, row=3, sticky=W)
for child in mainFrame.winfo_children():
child.grid_configure(padx=5, pady=5)
nomEntry.focus()
#root.update_idletasks()
root.overrideredirect(1)
root.mainloop()
root.destroy()
I want to use a tkinter window that removes all window manager decorations from that window with overrideredirect()
method.
In this case, I don't have any more decoration, but I am no longer able to access the Entry
field, while the "Validation"
button is operational and exits the window.
If I comment the line root.overrideredirect(1)
everything works normally, with decoration.
I tried adding the line root.update_idletasks()
, but it doesn't change my problem: it's ok but with decorations.
How do I get an operational window without decorations?