Tkinter:
Tkinter is a standard Python GUI library that provides a set of tools and widgets to create desktop applications with graphical interface.
- The name “Tkinter” comes from “Tk interface”.
FUNDAMENTAL STRUCTURE OF TKINTER PROGRAM:
- Importing Tkinter modules
- Creating the main window for GUI app
- Adding widgets to the app
- Enter the main event loop
To getĀ the screen size in Tkinter we use two methods those are "winfo_screenwidth()"
and “winfo_screenheight()"
fromĀ TK() window object.
CODE
import tkinter #create a tkinter root window root = tkinter.Tk() #Get the screen width screen_width = root.winfo_screenwidth() #print the screen width print(screen_width) #Get the screen heigth screen_height = root.winfo_screenheight() #print the screen heigth print(screen_height) #run the Tkinter main loop root.mainloop()