I've made a widget movable after using overrideredirect(1)
, everything is fine except that when I drag the windo left and right many times fast or drag it until the borders of my screen, when doing so the widgets it has in it are disappearing.
Here's my code:
from tkinter import *
import mouse
root = Tk()
root.overrideredirect(1)
root.geometry("700x200+500+200")
BG = Label(root, bd=0)
BG.pack(fill=BOTH, expand=True)
var1 = StringVar()
entry1 = Entry(BG, width=80, textvariable=var1)
entry1.place(x=170,y=57)
#-----------------------------------------------
var2 = StringVar()
entry2 = Entry(BG,width=80, textvariable=var2)
entry2.place(x=170,y=100)
def standard_bind():
BG.bind('<B1-Motion>', lambda e: event(e, Mode=True))
def event(widget, Mode=False):
global x, y
if Mode:
x = widget.x
y = widget.y
BG.bind('<B1-Motion>', lambda e: event(e))
root.geometry('+%d+%d' % (mouse.get_position()[0]-x, mouse.get_position()[1]-y))
BG.bind('<B1-Motion>', lambda e: event(e, Mode=True))
BG.bind('<ButtonRelease-1>', lambda e: standard_bind())
root.mainloop()