rectangletangle
rectangletangle

Reputation: 52911

Toplevel widgets in Tkinter

I have a Toplevel widget I'd like it so that it would never appear within the confines of the main Tk window. Basically so that when the Toplevel appears it doesn't cover up any of the main Tk window.

Upvotes: 1

Views: 383

Answers (2)

Bryan Oakley
Bryan Oakley

Reputation: 385900

You want to use wm_geometry and a tiny bit of math to calculate and set a suitable starting position for the second toplevel.

Upvotes: 1

Kevin Walzer
Kevin Walzer

Reputation: 556

You could just set up a separate toplevel, cf:

self.newwindow = Toplevel(self)
self.newwindow.title('New Window')

and then embed the widget in the separate toplevel.

Upvotes: 0

Related Questions