Hallo Community,
ich habe folgendes Problem:
Bei dem python-code, den ich hier einfügen werde, speichert sich nur der erste Buchstabe und nicht der volle Text. Wie kann man das ändern. Also so, dass sich der ganze Text speichert.
Code:
from tkinter import filedialog
import tkinter as tk
def Texteditor():
def saveFile():
file = filedialog.asksaveasfile()
filetext = str(text.get(1.0))
file.write(filetext)
window = tk.Tk()
window.title('Texteditor')
window.geometry('600x380+400+50')
button = tk.Button(text='speichern', bg='#00FF00', command=saveFile)
button.pack()
text = tk.Text(window)
text.pack()
window.mainloop()
anmeldung = tk.Tk()
anmeldung.title('Anmeldung')
anmeldung.geometry('300x300')
lab1 = tk.Label(master=anmeldung, text="Vorname:", font="Arial 10 bold", bg='#23ff32')
lab1.pack()
text = tk.Text(anmeldung, height=1, width=10)
text.pack()
lab1 = tk.Label(master=anmeldung, text="Nachname:", font="Arial 10 bold", bg='#23ff32')
lab1.pack()
text = tk.Text(anmeldung, height=1, width=10)
text.pack()
but1 = tk.Button(master=anmeldung, text="Texteditor", font="Arial 10 bold", bg='#23ff32', command=Texteditor)
but1.pack()
anmeldung.mainloop()
Vielleicht könnt ihr mir ja bei der frage helfen.
MfG Jonah (Kuchenmonster 31)