Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Tkinter focus
#1
import tkinter as tk
window=tk.Tk()
window.title('Impedance simulation')
window.geometry('900x700')

entry1=tk.Entry(window,show=None,textvariable=tk.StringVar(value=1))
entry2=tk.Entry(window,show=None,textvariable=tk.StringVar(value=2))
entry3=tk.Entry(window,show=None,textvariable=tk.StringVar(value=3))
entry1.pack()
entry2.pack()
entry3.pack()

def locate(key):
    print(window.focus_get())

window.bind('<Key>', locate)
window.mainloop()
Hi,
im struggling to locate the focused entry
the focus_get() only tells me it's an entry not which one
is there a way to locate the exact entry that's focused?
Thank you!!!
Reply


Messages In This Thread
Tkinter focus - by catlessness - Mar-08-2020, 05:24 PM
RE: Tkinter focus - by Larz60+ - Mar-08-2020, 07:14 PM
RE: Tkinter focus - by catlessness - Mar-09-2020, 02:12 PM
RE: Tkinter focus - by Larz60+ - Mar-09-2020, 07:23 PM
RE: Tkinter focus - by catlessness - Apr-02-2020, 07:14 PM
RE: Tkinter focus - by joe_momma - Apr-03-2020, 05:24 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  [Tkinter] Open tkinter colorchooser at toplevel (so I can select/focus on either window) tabreturn 4 1,836 Jul-06-2022, 01:03 PM
Last Post: deanhystad
  How to move in entries using the arrow keys by applying the bind and focus? pymn 4 4,577 Apr-06-2022, 04:29 AM
Last Post: pymn
  How to disable focus on Frame in Tkinter? szafranji 1 2,975 May-13-2020, 10:45 PM
Last Post: DT2000
  QComboBox doesn't display selection as long as it has not lost the focus Meaulnes 3 3,154 May-07-2020, 03:42 PM
Last Post: Meaulnes
  [Tkinter] Resetting scale value back to 0 after the slider loses focus lwhistler 3 6,877 Mar-07-2017, 10:01 PM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020