Tkinter - Keyboard Input

In this example we have added two new fucntions and attached them to the events of a set key being pressed. This triggers set functions to be ran.
import tkinter as tk

mywindow = tk.Tk()

def buttonPress():
    print("Button Pressed!!")

def textBox():
def slideValue():
    print (Slider.get())

label = tk.Label(mywindow, text="Label Text")

button = tk.Button(mywindow,text='Press',command=buttonPress)

textb = tk.Entry(mywindow,text="Entry")
textbutton = tk.Button(mywindow,text="Text Box",command=textBox)

Slider = (tk.Scale(mywindow,label=('Slider'),variable=0))
SliderButton = (tk.Button(mywindow,text='Slider',command=slideValue))

def func_return(event):
    print ("You hit return")
mywindow.bind("<Return>", func_return)

def func_w(event):
    print ("You hit w")
mywindow.bind("<KeyPress-w>", func_w)
This creates the same frame:

But when return or "w" are pressed after each other, the follwoing is returned.
You hit return
You hit w
You hit return
You hit w
You hit return
You hit w
You hit return
You hit w
You hit return

Related Sections

Python - Learn the python from the basics up. This fast track example code course will get you creating powerful python programs in no time.
Tkinter - Learn the key features of the tkinter to allow you to create user interfaces for your python programs.

Must Read Articles

Tkinter - Combo Box - This is a short example showing how to use combo boxes in a GUI.
Tkinter - Radio Buttons - A short example of how to create a GUI with radio buttons.
Tkinter _ Canvas - Canvas allows for a range of shapes to be plotted, such as circles, squares, lines and labels.
Tkinter - Pack vs Grid vs Place - tkinter provides flexibility in how the layout the widgets. 
Pickle - The pickle library allows a program to save data in a binary file.
Python - List Comprehension - Create powerful list comprehension expressions.
Python - Generators - Learn about generator statements.
Python - Data types - The learn about the key datatypes in the python language.