Tkinter is a Python GUI toolkit, which is widely known for developing full-fledged functional desktop applications. Tkinter provides many built-in libraries, widgets, and modules to develop any kind of application. You can use the factory and class library functions to implement additional functionality of the application.
Since Tkinter is a cross-platform GUI library, an application programmed in Windows can run in macOS as well as Linux devices. However, some functions don't support cross-platform ability for which you have to refer to the additional factory method or function specified in the documentation.
For example, if we want to display a tkinter application in full screen in macOS, then we have to first enable the fullscreen property for the application using attributes('-fullscreen', True) method. It enables the application window to remain in full screen.
The other method that helps to disable the toolbar from the top on macOS is overrideredirect(boolean) method. It accepts Boolean values for enabling and disabling the toolbars on the navigation bar. The following example demonstrates how it works.
# Import the library from tkinter import * from tkinter import filedialog # Create an instance of window win= Tk() # Set the geometry of the window win.geometry("700x350") # Create a full screen window win.attributes('-fullscreen', True) win.overrideredirect(True) # Create a label Label(win, text= "Click the button to exit out of the fullscreen", font= ('Aerial 16 bold')).pack(pady= 15) # Define a function to open a file in the system def exit_program(): win.destroy() # Create a button to trigger the dialog button = Button(win, text="Exit", command=exit_program) button.pack(pady= 20) win.mainloop()
Running the above code will display a fullscreen window containing a Button and a Label widget. The button can be used to exit the fullscreen of the application.