How can I update Entry without a "submit" button in Tkinter?
<p>So I have <code>Entries</code> which have some values assigned to them from a CFG File. I want to modify the CFG file when the <code>Entry</code> is updated, live, without a <code>submit</code> button; </p>

<p>Using <code>&lt;Key&gt;</code> binding will work but will take only the previous value, not the current one, as the last key pressed is not taken into consideration as a value, but as a <code>key-press</code>.</p>

<p>For example:</p>

<pre><code>class EntryBox:
    def __init__(self, value, option, section, grid_row, master_e):
        self.section = section
        self.option = option
        self.box = Entry(master_e)
        self.box.grid(column=0, row=grid_row)
        self.serial_no = grid_row
        self.box.insert(0, value)
        self.box.bind("&lt;Key&gt;", lambda event: update_cfg(event, self, self.get_value()))

    def get_value(self):
        return self.box.get()


    def update_cfg(evt, entry_box,new_value):
        global config_file
        config_file.set(entry_box.section, entry_box.option, new_value)
        print "Config file modified. "+entry_box.section+" "+entry_box.option+" "+new_value
</code></pre>

<p>If the value in the <code>entry</code> is <code>05R</code> when I click on the <code>entry</code> and press 6, it will print <code>Config file modified. CURRENT_MEASUREMENT_EXAMPLE_HP shunt_resistance 05R</code>; after I press 7, it will print <code>Config file modified. CURRENT_MEASUREMENT_EXAMPLE_HP shunt_resistance 0R56</code> and so on, always with one keypress behind. The only way to live update it after the value has been changed is to press the <code>TAB</code> or <code>arrow</code> buttons. </p>

<p>I decided that <code>&lt;Key&gt;</code> was not the right option in my case and instead used <code>&lt;FocusOut&gt;</code>. This way, if you either change the value using the mouse or keyboard <code>TAB</code>, on focus out it will update it.</p>

python user-interface tkinter keypress entry