1

When using overrideredirect or something like root.wm_attributes('-type', 'splash') my entry box cannot get focus on user's click.

I am developing a GUI which I want to maintain the style of previous windows and not have this window stand out with the window header. How do I get rid of the RPI window bar but maintain entry box functionality.

Saad
  • 3,340
  • 2
  • 10
  • 32
TheOuz
  • 47
  • 7

1 Answers1

2

When using the splash window type (Linux only), you can make the entry get the keyboard focus by using focus_force(), e.g. binding it to the left click.

import tkinter as tk
root = tk.Tk()
root.wm_attributes('-type', 'splash')
e = tk.Entry(root)
e.pack()
# force focus on left click:
root.bind('<1>', lambda ev: ev.widget.focus_force())
root.mainloop()
j_4321
  • 15,431
  • 3
  • 34
  • 61