Code: Alles auswählen
import tkinter as tk
class Test:
def __init__(self):
master = tk.Tk()
tk.Label(master, text = "First Name").grid(row = 0, column = 0)
tk.Label(master, text = "Last Name").grid(row = 1, column = 0)
e1 = tk.Entry(master)
e2 = tk.Entry(master)
button = tk.Button(master, text = "Check", command = self.names)
e1.grid(row = 0, column = 1)
e2.grid(row = 1, column = 1)
button.grid(row = 2, column = 1)
master.mainloop()
def names(self):
"""Read in Names and print them"""
first_name = e1.get()
last_name = e2.get()
print(first_name, last_name)
Test()