pythonuser-interfacetkintergraphical-interaction

I think I made a mistake with this tkinter widget


So till now I want to make a simple button but it gives me an error screen, what am I doing wrong? Here's my code:

import tkinter as tk
import math
import time

tk = tk.Tk()
tk.geometry()
tk.attributes("-fullscreen", True)

exit_button = tk.Button(tk, text = "Exit", height = 2, width = 2, command = tk.destroy)
exit_button.place(x=1506, y=0)





tk.mainloop()

Solution

  • You are shadowing tk with something else:

    import tkinter as tk
    
    root = tk.Tk()
    root.geometry()
    root.attributes("-fullscreen", True)
    
    exit_button = tk.Button(root, text="Exit", height=2, width=2, command=root.destroy)
    exit_button.place(x=1506, y=0)
    
    
    tk.mainloop()