Hi,
trying to play with fullscreen, to save the last configuration of the screen, i whanted to obtain the info if the window is in fullscreen or not. But nothing works.
I tried with
- .attributes('fullscreen') => this always results in 0
- .wm_state('zoomed') => this doesn'r return a value, or more exact: {str}''
How to check if the window is zoomed or fullscreen?
Working with windows.
Here's my (reduced) code:
trying to play with fullscreen, to save the last configuration of the screen, i whanted to obtain the info if the window is in fullscreen or not. But nothing works.
I tried with
- .attributes('fullscreen') => this always results in 0
- .wm_state('zoomed') => this doesn'r return a value, or more exact: {str}''
How to check if the window is zoomed or fullscreen?
Working with windows.
Here's my (reduced) code:
try:
import tkinter as tk
except ImportError:
import Tkinter as tk
class Window(tk.Frame):
#def __init__(self, master, **kwargs):
def __init__(self, master):
self.master = master
self.master.bind("<F11>", self.do_fullscreen)
self.master.bind("<Escape>", self.end_fullscreen)
self.master.geometry("400x500+0+0")
def do_fullscreen(self, event=None):
self.master.wm_state('zoomed')
#fullscreen = self.master.attributes('-fullscreen')
fullscreen = self.master.wm_state('zoomed')
self.master.title('fullscreen=' + str(fullscreen))
def end_fullscreen(self, event=None):
self.master.wm_state('normal')
#fullscreen = self.master.attributes('-fullscreen')
fullscreen = self.master.wm_state('zoomed')
self.master.title('fullscreen=' + str(fullscreen))
if __name__ == "__main__":
root = tk.Tk()
frame = Window(root)
root.mainloop()Note that storing the info in a variable is no option, because other events outside of <F11> and <Escape> can change the window, p.e. clicking on the head of the window and drag it down when fullscreen, is changing the window to 'normal'
