1 #!/usr/bin/env python2 #-*-coding:utf-8-*-3 4 ImportTkinter as TK5 6 classFullscreenapp (object):7 def __init__(Self, master, * *Kwargs):8Self.root =Master9 #self.tk.attributes ('-zoomed ', True) # This just maximizes it so we can see the window. It 's nothing-to-do with fullscreen.TenSelf.frame =tk. Frame (self.root) One Self.frame.pack () ASelf.state =False -Self.root.bind ("<F11>", Self.toggle_fullscreen) -Self.root.bind ("<Escape>", Self.end_fullscreen) the - defToggle_fullscreen (Self, event=None): -Self.state = notSelf.state#Just toggling the Boolean -Self.root.attributes ("-fullscreen", Self.state) + return " Break" - + defEnd_fullscreen (Self, event=None): ASelf.state =False atSelf.root.attributes ("-fullscreen", False) - return " Break" - -root=tk. Tk () -app=Fullscreenapp (Root) -Root.mainloop ()
Application scenario: When using the Raspberry Pi, the use of the 7-inch screen, so when used, it is certainly hoped that the interface can be displayed in full screen.
Python Tkinter full Screen display