Check if Entry widget is selected
<p>I'm making a program on the Raspberry Pi with a touchscreen display. 
I'm using Python Tkinter that has two entry widgets and one on screen keypad. I want to use the same keypad for entering data on both entry widgets. </p>

<p>Can anyone tell me how can i check if an entry is selected? Similar like clicking on the Entry using the mouse and the cursor appears. How can I know that in Python Tkinter?</p>

<p>Thank you.</p>

<p>You can use events and bindigs to catch FocusIn events for your entries.</p>

<pre><code>entry1 = Entry(root)
entry2 = Entry(root)

def callback_entry1_focus(event):
    print 'entry1 focus in'

def callback_entry2_focus(event):
    print 'entry2 focus in'

entry1.bind("&lt;FocusIn&gt;", callback_entry1_focus)
entry2.bind("&lt;FocusIn&gt;", callback_entry2_focus)
</code></pre>

python tkinter raspberry-pi touchscreen raspberry-pi3