I want to create window, which takes input from the user and after clicking show, it prints whatever has been inputted:
import sys
import tkinter as tk
import time
class Application(tk.Frame):
def __init__(self):
super().__init__()
self.pack()
self.create_widgets()
def create_widgets(self):
self.hi_there = tk.Button(self,text = "show",command =
self.Show_enter,fg="red",bg="blue")
self.hi_there.pack(side = "right")
self.UN = tk.Label(text="User Name").pack(side="left")
self.enter = tk.Entry(bd=5, bg="red").pack(side="right")
def Show_enter(self):
s = self.enter.get()
print(s)
root = tk.Tk()
app = Application()
app.master.title("coool")
app.mainloop()
However, i get the error:
AttributeError: 'NoneType' object has no attribute 'get'