wxPython 中的 wx.DisplaySize()函数
在本文中,我们将了解 wxPython 中的 DisplaySize()函数。 DisplaySize()函数是 wxPython 的父函数之一。它返回以像素为单位的显示大小。如果调用者对相应的值不感兴趣,则任何一个输出指针都可以为 None。
Syntax:
wx.DisplaySize()
Parameters:
DisplaySize() function requires no parameters.
Returns:
( width, height )
Return Type:
tuple
代码示例:
# importing the module
import wx
# definition of the Example class
class Example(wx.Frame):
# instantiating the class
def __init__(self, *args, **kwargs):
super(Example, self).__init__(*args, **kwargs)
self.InitUI()
# method for creation of user interface
def InitUI(self):
# print the size of display
print(wx.DisplaySize())
# definition of the main function
def main():
# creating an App object
app = wx.App()
# creating an Example object
ex = Example(None)
# showing the Example object
ex.Show()
# running the App object
app.MainLoop()
# driver code
if __name__ == '__main__':
main()
输出:
(1536, 864)