टिंकर प्रारंभ में एक विंडो या फ़्रेम ऑब्जेक्ट बनाता है जहां सभी विजेट, फ़्रेम प्रदर्शित होते हैं।
टिंकर घटक उपयोगकर्ता द्वारा परिभाषित ज्यामिति के अनुसार विंडो के आकार और चौड़ाई को समायोजित करते हैं।
स्क्रीन का आकार प्राप्त करने के लिए, हम winfo_screenwidth() . का उपयोग कर सकते हैं जो स्क्रीन की चौड़ाई और winfo_screenheight() . लौटाता है पिक्सेल में स्क्रीन की ऊंचाई के लिए।
उदाहरण
इस उदाहरण में, हम स्क्रीन के आकार को आउटपुट के रूप में प्रिंट करेंगे,
#Import the required libraries
from tkinter import *
#Create an instance of tkinter frame
win= Tk()
#Set the geometry of frame
win.geometry("650x250")
#Get the current screen width and height
screen_width = win.winfo_screenwidth()
screen_height = win.winfo_screenheight()
#Print the screen size
print("Screen width:", screen_width)
print("Screen height:", screen_height)
win.mainloop() आउटपुट
कोड चलाने से एक विंडो प्रदर्शित होगी और स्क्रीन का आकार प्रिंट होगा।
Screen width: 1366 Screen height: 768