How do i get aspect ratio of system display resolution in python?
When I check for display resolution in Ubuntu, I see 1024x768(4:3). How do I get aspect ratio 4:3 in Python?
How do i get aspect ratio of system display resolution in python?
When I check for display resolution in Ubuntu, I see 1024x768(4:3). How do I get aspect ratio 4:3 in Python?
For this answer I used the following resource: How to get the screen size in Tkinter?
The question you're asking is (1) How do I get the screen resolution in Python (2) How do I convert this resolution to a aspect ration. I solved this problem in the following way:
import Tkinter
import Fraction as f
root = Tkinter.Tk()
width = root.winfo_screenwidth()
height = root.winfo_screenheight()
frac = f.Fraction(width,height)
print frac
Note that this gives the lowest denominator. So for a 1680x1050 screen this is 8/5 instead of a possibly expected 16/10.