Code: Alles auswählen
#!/usr/bin/python
from Tkinter import *
def ok(textfeld):
text = textfeld.get(1.0, END)
print text
def gui():
root = Tk()
textfeld = Text(root, width=45, height=6)
textfeld.grid()
button = Button(root, text="Get", command=lambda: ok(textfeld))
button.grid()
root.mainloop()
gui()
Code: Alles auswählen
#!/usr/bin/python
import Tkinter as tk
def ok(textfeld):
text = textfeld.get(1.0, END)
print text
def gui():
root = tk.Tk()
textfeld = tk.Text(root, width=45, height=6)
textfeld.grid()
button = tk.Button(root, text="Get", command=lambda: ok(textfeld))
button.grid()
root.mainloop()
gui()
was mache ich falsch????File "tkentry.py", line 5, in ok
text = textfeld.get(1.0, END)
NameError: global name 'END' is not defined