Multi-Monitor Support

Jesse Hager wrffruntre at tznvy.pbz.ROT13
Tue May 2 14:55:19 EDT 2006


Mark rainess wrote:
> Hello,
> 
> 
> Does Python or wxPython include any support for multiple monitors. In my
> application multiple monitors are located at a distance. It is not
> convenient to move a window from the main monitor to one of the others.
> I want to have the option to open an an application on any connected
> monitor. I am using wxPython. Does anyone know how to do it?
> 
> Thanks
> 
> Mark Rainess

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()

Creating a window on a different display is the same as creating one on
the main display, all you need to do is specify coordinates somewhere on
the alternate display when calling the constructor.

Use wx.Display to find out about the displays on the system, it also
lets you query and set the current video mode for a display.

Hope this helps.

-- 
Jesse Hager
email = "wrffruntre at tznvy.pbz".decode("rot13")



More information about the Python-list mailing list