External Exam Download Resources Web Applications Games Recycle Bin

Input

get input.py

#1. initialise:
from tkinter import *
from tkinter import messagebox 
window = Tk()

#2. controls:   
lblInstructions = Label(text="Enter username:")
txtInput = Entry() 
btnSubmit = Button(text="Submit")

#3. events:
def personalHi(event):
  username = txtInput.get()
  messagebox.showinfo("Title here","Hi " + username)

#4. bindings:
btnSubmit.bind("<ButtonPress>", personalHi)

#5. pack:
lblInstructions.pack(side="top", anchor="nw")
txtInput.pack(side="top", anchor="nw")
btnSubmit.pack(side="top", anchor="nw")

#6. run:
window.mainloop()