Textfelder

Fragen zu Tkinter.
Antworten
nightm4r3^
User
Beiträge: 83
Registriert: Montag 11. Februar 2008, 15:43
Kontaktdaten:

High all!
Ich habe eine Frage zu Textfeldern in Tkinter:
Soviel ich weiß, kann ich ein Textfeld mit dem Befehl:

Code: Alles auswählen

import Tkinter as tk
root=tk.Tk()
textfeld=tk.Text(root, width=6, height=1)
textfeld.place(x=10, y=10)
erstellen. Also ganz einfach. Wenn ich jetzt in das Feld etwas eintragen möchste, geschicht das doch so, oder?

Code: Alles auswählen

textfeld.insert(text)
allerdings, zeigt python mir dann eine Fehlermeldung an, das der Befehl insert, genau 3 Argumente benötigt, aber keins gegeben ist. Was genau muss denn in die Klammer hinein?

mfg nightm4r3^
Benutzeravatar
HWK
User
Beiträge: 1295
Registriert: Mittwoch 7. Juni 2006, 20:44

Code: Alles auswählen

.insert ( index, text, tags=None )
Inserts the given text at the given index.
If you omit the tags argument, the newly inserted text will be tagged with any tags that apply to
the characters both before and after the insertion point.
If you want to apply one or more tags to the text you are inserting, provide as a third argument a
sequence of tag strings. Any tags that apply to existing characters around the insertion point are
ignored.
MfG
HWK
Antworten