所以我是Tkinter的新手,没有示例代码可供您查看,但是我确实有一个问题,那就是如何使Entry Widget具有数量有限的整数供选择,例如:
当点击输入框时,它提供了选择某些整数的选项,例如 [1] [2] [3]等等
答案 0 :(得分:0)
点击here以获取更多信息
$('.onlyalphanumerics').on('keypress contextmenu', function (e) {
//Validation not required for special keys such as back space, tab ,home,end ,delete ,left and right arrows
var specialKeys = new Array();
specialKeys.push(8, 9, 46, 35, 36, 37, 39);
if (specialKeys.indexOf(e.keyCode) == -1) {
var regex = new RegExp("^[a-zA-Z0-9-\)\(]*$");
var keyCode = e.keyCode == 0 ? e.charCode : e.keyCode;
var str = String.fromCharCode(!e.charCode ? e.which : e.charCode);
if (regex.test(str)) {
return true;
}
e.preventDefault();
return false;
}
});