How can I get the screen width in python? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How can I get the screen width in python?

I write code for game with pygame package and I want to set the game screen width the same as the width of the computer screen If you know about some package for that in python please tell me Thank you

24th May 2019, 11:04 AM
Naty
5 Answers
+ 1
Using tkinter (I don't know in pygame) from tkinter import * win = Tk() print(win.winfo_screenwidth(), win.winfo_screenheight()) win.destroy()
24th May 2019, 11:08 AM
Théophile
Théophile - avatar
+ 1
Théophile thank u very much
24th May 2019, 11:43 AM
Naty
+ 1
You're welcome! Did it work?
24th May 2019, 11:44 AM
Théophile
Théophile - avatar
+ 1
Yes it did Thank you
24th May 2019, 11:47 AM
Naty
0
But IDK why when I'm running the game it doesn't feel like a real game or real software If you know what I mean for example It doesn't center itself automatically on the screen like real games do I don't know why Maybe you could help .... Thank you
24th May 2019, 11:51 AM
Naty