splash27
splash27

Reputation: 2107

How to expand Toplevel window in tkinter Python?

When I generate new Toplevel window, I want it appears expanded to fullscreen. I have no idea how to do that. It's impossible to use overrideredirect() method in my situation. I have to leave the title of window. When i set the size of screen resolution:

self.geometry("{0}x{1}+0+0".format(self.winfo_screenwidth(), self.winfo_screenheight()))

window fills all screen space, but it still not fully expanded. In this case I have to press "expand" button in the top right corner of window to completly expand it. What can I do to generate Toplevel window already expanded?

Upvotes: 2

Views: 1618

Answers (2)

Deshan Nawanjana
Deshan Nawanjana

Reputation: 1

from Tkinter import *
root = Tk()
root.wm_attributes('-topmost', 1)
root.mainloop()

Upvotes: 0

FabienAndre
FabienAndre

Reputation: 4604

You could use wm_attributes method (of Tk or Toplevel) to set the zoomed attribute.

self.wm_attributes("-zoomed", "1")

You can find more attributes description in Tk doc.

Note that there is also a fullscreen attribute, and that you can read the state by passing only attribute name, ie wm_attributes("-zoomed").

Upvotes: 4

Related Questions