1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
|
import tkinter as tk
root = tk.Tk()
root.geometry("400x240")
#---------------------------------------
def getTextInput():
result = textExample.get("1.0", "end")
print(result)
long = len(result)
print(long)
print("Longueur de la chaine = " + str(long) +" caracteres")
print(result)
#===================================
textExample = tk.Text(root, height=10)
textExample.pack()
#-------------------------------------
btnRead = tk.Button(root, height=1, width=10, text="Read",
command=getTextInput)
btnRead.pack() |