tekst [PL]
import tkinter as tk
def select(event):
widget = root.winfo_containing(event.x_root, event.y_root)
if widget and hasattr(widget, 'selectable'):
widget['bg'] = 'red'
root = tk.Tk()
for i in range(9):
for e in range(9):
b = tk.Button(root, text="X")
b.selectable = True
b.grid(row=e, column=i)
root.bind('<B1-Motion>', select)
l = tk.Label(root, text="Label which can't be selected")
l.grid(row=9, column=0, columnspan=9)
b = tk.Button(root, text="Button which can't be selected")
b.grid(row=10, column=0, columnspan=9)
e = tk.Entry(root)
e.insert('end', "Entry which can't be selected")
e.grid(row=11, column=0, columnspan=9)
root.mainloop()
If you like it
Buy a Coffee
furas.pl