How can I get the screen size in Tkinter?

I would like to know if it is possible to calculate the screen size using Tkinter.

I wanted this so that can make the program open up in the center of the screen...


import tkinter as tk

root = tk.Tk()

screen_width = root.winfo_screenwidth()
screen_height = root.winfo_screenheight()

A possible solution

import os

os.system("xrandr  | grep \* | cut -d' ' -f4")

My output:

1440x900
0