[wxpython] 다중모니터 감지하기

Posted by 백창
2017. 6. 28. 15:17 개발/Python
반응형

#1


wxPython 은 GUI를 만들 수 있는 오픈소스 라이브러리이다.


GUI를 만드는건 만드는건데 가끔 보면 듀얼모니터, 다중모니터를 사용하면서 


모든 화면에 프로그램을 띄울 필요가 생길 것이다.


그걸 어떻게 감지하는지 퍼온 소스를 적어 놓겠다.


#2


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import wx
 
app = wx.App()
 
#To get the count of displays
num_displays = wx.Display.GetCount()
 
#Open a frame on each display
for display_num in range(num_displays):
    #Get a display object
    display = wx.Display(display_num)
 
    #To get a wx.Rect that gives the geometry of a display
    geometry = display.GetGeometry()
 
    #Create a frame on the display
    frame = wx.Frame(None,-1,"Display %d"%display_num,
    geometry.GetTopLeft(),geometry.GetSize())
 
    #Make the frame visible
    frame.Show()
 
app.MainLoop()
cs


모니터의 갯수를 저장해서 반복문을 돌며 각 화면마다 프레임을 실행해주는 소스가 되겠다.


#3


https://bytes.com/topic/python/answers/486021-multi-monitor-support

반응형

'개발 > Python' 카테고리의 다른 글

[Python] 웹페이지 변화 감지하기  (2) 2017.04.27