Einschränkung des Wertes im Tkinter -Eintrags -Widget

Post a reply

Smilies
:) :( :oops: :chelo: :roll: :wink: :muza: :sorry: :angel: :read: *x) :clever:
View more smilies

BBCode is ON
[img] is ON
[flash] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: Einschränkung des Wertes im Tkinter -Eintrags -Widget

by Anonymous » 12 Feb 2025, 04:01

Ich muss die Werte im Eintrags -Widget nur auf Zahlen beschränken. Die Art und Weise, wie ich implementiert habe, ist: < /p>

import numpy as np
from Tkinter import *;
import tkMessageBox;

class window2:

def __init__(self,master1):

self.panel2=Frame(master1)
self.panel2.grid()

self.button2=Button(self.panel2,text="Quit",command=self.panel2.quit)
self.button2.grid()

self.text1=Entry(self.panel2)
self.text1.grid()
self.text1.bind('', self.keybind1)
self.text1.focus()

def keybind1 (self,event):
if event.int in np.linspace(0,9,10):
print event.int

root1=Tk()
window2(root1)
root1.mainloop()
< /code>

Ich erhalte immer wieder Fehlermeldung, dass die Ereignisinstanz kein Attribut 'int' hat. Was soll ich tun?

Top