Python tkInter Entry fun

前端 未结 3 510
猫巷女王i
猫巷女王i 2020-12-10 09:02

Playing around with Python - tkInter - Entry widget - when I use validatecommand (below), the check happens the first time the string > Max, but when I continue to enter tex

3条回答
  •  隐瞒了意图╮
    2020-12-10 09:33

    I'm sure exactly what the reason is, but I have a hunch. The validation check is done every time the entry is edited. I did some testing and found that it does indeed execute, and can do all sorts of things during the validation every time. What causes it to stop working correctly is when you edit it from within the validatecommand function. This causes it to stop calling the validate function any further. I guess it no longer recognizes further edits to the entry value or something.

    lgal Serban seems to have the behind the scenes info on why this occurs.

提交回复
热议问题