wxPython - wx.DisplaySizeMM() function in wxPython

wxPython - wx.DisplaySizeMM() function in wxPython

The wx.DisplaySizeMM() function in wxPython returns the size of the screen (the entire display) in millimeters. This can be useful when you want to know the physical size of the display, for example, to compute the DPI (dots per inch) or other size-related metrics.

The function returns a tuple of (width, height) in millimeters.

Here's a simple example of how you can use the wx.DisplaySizeMM() function:

import wx

app = wx.App(False)  # Create a new app, don't redirect stdout/stderr to a window

width_mm, height_mm = wx.DisplaySizeMM()

print(f"Display width: {width_mm} mm")
print(f"Display height: {height_mm} mm")

app.MainLoop()

Keep in mind that the accuracy of this function can vary depending on how the underlying platform provides this information. Sometimes, the returned values might be estimates rather than precise measurements. If you require high precision, it might be necessary to measure the display size manually or use dedicated hardware tools.


More Tags

android-bottomsheetdialog econnrefused jframe devise resthub keyboard-shortcuts numericupdown laravel-5.1 portrait discord.js

More Programming Guides

Other Guides

More Programming Examples