widget1.update_idletasks()
widget2.update_idletasks()
if widget1.winfo_width() + widget2.winfo_width() > screensize[0]:
    widget1.grid(row=0)
widget2.grid(row=1)
Python Tkinter wrap widgets in frame if they reach the end of the screen