Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I think the only thing your missing is an <strong>invalidcommand (or invcmd)</strong>. What are you expecting validatecommand (or vcmd) to do if it returns false? According to the Tk Manual (see below), if vcmd returns False and validate is <em>not</em> set to none then invcmd will be called. The typical command for invcmd is Tkinter.bell, which makes a ding sound. Also note that vcmd and invcmd are very <em>touchy</em>, and will turn validate to 'none' if they encounter an exception, if the widget is changed in anyway inside the vcmd or invcmd functions or if vcmd does not return a valid Tcl boolean. In particular textvariable is notorious for causing issues, and <a href="http://www.tcl.tk/man/tcl/TkCmd/entry.htm#M7" rel="nofollow noreferrer">a section in Entry called valdation</a> specifically deals with that.</p> <p>Here are the relevant portions from Tk Command Entry (same for Spinbox). See below for more references. </p> <blockquote> <p>Command-Line Name: <strong>-validatecommand or -vcmd</strong><br> Database Name: <strong>validateCommand</strong><br> Database Class: <strong>ValidateCommand</strong><br> Specifies a script to eval when you want to validate the input into the entry widget. Setting it to {} disables this feature (the default). This command must return a valid Tcl boolean value. If it returns 0 (or the valid Tcl boolean equivalent) then it means you reject the new edition and it will not occur and the invalidCommand will be evaluated if it is set. If it returns 1, then the new edition occurs. See Validation below for more information. </p> <p>Command-Line Name: <strong>-invalidcommand or -invcmd</strong><br> Database Name: <strong>invalidCommand</strong><br> Database Class: <strong>InvalidCommand</strong><br> Specifies a script to eval when validateCommand returns 0. Setting it to {} disables this feature (the default). The best use of this option is to set it to bell. See Validation below for more information. </p> </blockquote> <p>Have a look at <a href="https://stackoverflow.com/a/4140988/1020470">this SO answer</a>, the <a href="http://www.tcl.tk/man/tcl/" rel="nofollow noreferrer">Tk commands</a> and <a href="http://epydoc.sourceforge.net/stdlib/Tkinter-module.html" rel="nofollow noreferrer">epydoc-Tkinter</a> for more references.</p> <p>There are so many duplicates to this question. <a href="https://stackoverflow.com/a/4372831/1020470">Python tkInter Entry fun</a><br> <a href="https://stackoverflow.com/a/8960839/1020470">Restricting the value in Tkinter Entry widget</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload