vorweg sei erwähnt, dass ich mich erst seit einem Tag mit Python beschäftige und noch nich sooooooo viel weiß.
Ich möchte wie gesagt in einer erstellten Entry-Box die maximale Zeichenanzahl auf "5" begrenzen, aber wirklich so,
dass nach der 5. Eingabe nichts mehr passiert und ds ganze gleichzeitig nur durch alphanumerische Zeichen passieren darf. Oft habe ich in dem Zusammenhang lediglich Hinweise auf die Abfrage oder Auswertung der Zeichenlänge gefunden, was mir aber nichts nützt.
So weit bin ich in etwa:
Code: Alles auswählen
import Tkinter as tk
root = tk.Tk()
image1 = tk.PhotoImage(file="C:/Users/ASROCK/Downloads/1.gif")
w = image1.width()
h = image1.height()
root.minsize(w, h)
root.maxsize(w, h)
root.geometry("%dx%d+0+0" % (w, h))
import tkFont
font1 = tkFont.Font ( family="Verdana", size=36)
font2 = tkFont.Font ( family="Verdana", size=22)
panel1 = tk.Label(root, image=image1)
panel1.pack(side='top', fill='both', expand='yes')
ent1 = tk.Entry(panel1, font=font1, width=6)
ent1.place(x = 500, y = 100)
def co1():
ent1get = ent1.get()
print ent1get
button2 = tk.Button(panel1, text='Send', font=font2, command=co1)
button2.place(x = 760, y = 100)
root.mainloop()