def set_transient(widget, master, relx=0.5, rely=0.3, expose=1):
 widget.withdraw()
 widget.transient(master)
 widget.update_idletasks()
 if master.winfo_ismapped():
  m_width = master.winfo_width()
  m_height = master.winfo_height()
  m_x = master.winfo_rootx()
  m_y = master.winfo_rooty()
 else:
  m_width = master.winfo_screenwidth()
  m_height = master.winfo_screenheight()
  m_x = m_y = 0
 w_width = widget.winfo_reqwidth()
 w_height = widget.winfo_reqheight()
 x = (m_x + ((m_width - w_width) * relx))
 y = (m_y + ((m_height - w_height) * rely))
 widget.geometry(('+%d+%d' % (x, y)))
 if expose:
  widget.deiconify()
 return widget

def set_transient ( widget , master , relx = 0.5 , rely = 0.3 , expose = 1 ) : widget . withdraw ( ) widget . transient ( master ) widget . update_idletasks ( ) if master . winfo_ismapped ( ) : m_width = master . winfo_width ( ) m_height = master . winfo_height ( ) m_x = master . winfo_rootx ( ) m_y = master . winfo_rooty ( ) else : m_width = master . winfo_screenwidth ( ) m_height = master . winfo_screenheight ( ) m_x = m_y = 0 w_width = widget . winfo_reqwidth ( ) w_height = widget . winfo_reqheight ( ) x = ( m_x + ( ( m_width - w_width ) * relx ) ) y = ( m_y + ( ( m_height - w_height ) * rely ) ) widget . geometry ( ( '+%d+%d' % ( x , y ) ) ) if expose : widget . deiconify ( ) return widget
make an existing toplevel widget transient for a master .