获取屏幕大小有两种方法可以办到:

  1.wxPython里的

  2.win32api

 

 

 1 # coding:gb2312
 2 # wxApp.py 
 3 # author: aoogur
 4 import os
 5 import wx
 6 from win32api import GetSystemMetrics
 7 
 8 class Frame(wx.Frame):
 9     def __init__ (self):
10         wx.Frame.__init__(self,None,-1,title="wxApp.",size=(250,250),pos=(0,0))
11 
12         #一种方法(wxPython)
13         mm=wx.DisplaySize()
14         print "width=",mm[0]
15         print 'height=',mm[1]
16         #另一种方法
17         print "width =", GetSystemMetrics (0)
18         print "height =",GetSystemMetrics (1)
19 class App(wx.App):
20     def OnInit(self):
21         frame = Frame()
22         frame.Show(True)
23         return True
24     
25 if __name__ == "__main__":
26     app = App(False)
27     app.MainLoop()

 

 

 

相关文章:

  • 2022-01-08
  • 2021-07-17
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-02-16
  • 2022-12-23
  • 2021-09-16
  • 2022-12-23
  • 2021-09-09
  • 2021-07-24
  • 2022-01-08
相关资源
相似解决方案