The other day, I saw an interesting question in the wxPython IRC channel. They were asking if there was a way to set which display their application would appear on. Robin Dunn, the creator of wxPython, gave the questioner some pointers, but I decided to go ahead and write up a quick tutorial on the topic.
The wxPython toolkit actually has all the bits and pieces you need for this sort of thing. The first step is getting the combined screen size. What I mean by this is asking wxPython what it thinks is the total size of the screen. This would be the total width and height of all your displays combined. You can get this by calling wx.DisplaySize(), which returns a tuple. If you would like to get individual display resolutions, then you have to call wx.Display and pass in the index of the display. So if you have two displays, then the first display’s resolution could be acquired like this:
index = 0 display = wx.Display(index) geo = display.GetGeometry()
Let’s write up a quick little application that has a single button that will just switch which display the application is on. Continue reading wxPython: Set Which Display the Frame is on