Buğra Coşkun Buğra Coşkun - 1 year ago 97
Python Question

Wm attributes and '-zoomed' doesn't work?

I tried the same codes in Python2 and Python3 to see if the wm attributes would work in Python3 (I generally use Python2)

root.call("wm", "attributes", ".", "-zoomed", "True")
root.attributes('-zoomed', True)
root.wm_attributes('-zoomed', True)

but it gives me this error:

_tkinter.TclError: wrong # args: should be "wm attributes window ?-alpha ?double?? ?-transparentcolor ?color?? ?-disabled ?bool?? ?-fullscreen ?bool?? ?-toolwindow ?bool?? ?-topmost ?bool??"

I also tried these:

root.wm_state('-zoomed', True)
root.state('-zoomed', True)

but gave me this error:

TypeError: wm_state() takes at most 2 arguments (3 given)

I'm using Windows 7 although it seems to work for @ParvizKarimli who is also using windows 7.

Am I doing it wrong ? And is there an alternate method to maximize the window ?

Answer Source

If you want to get fullscreen without title bar:
root.attributes('-fullscreen', True)
And if you want to get fullscreen with title bar:
root.wm_state('zoomed') or just root.state('zoomed')