Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Using 2 screens in wxpython
#1
I am trying to use a 19" T.V with my laptop connecting it via the hdmi port.
I am running python 3.53 and wxpython 4.0.2 on my Linux Mint 18.2 HP laptop.
I found a script which allowed me to set this up. I have just been testing it out but there seems to be a snag.
num_displays = wx.Display.GetCount()

#Open a frame on each display
for display_num in range(0,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
    if display_num == 0:
        frame0 = wx.Frame(None,-1,"Display %d"%display_num, geometry.GetTopLeft(),geometry.GetSize())
        frame0.Show()
    else:
        frame1 = wx.Frame(None,-1,"Display %d"%display_num, geometry.GetTopLeft(),geometry.GetSize())
        frame1.Show()
vbox0 = wx.BoxSizer(wx.VERTICAL)

gs = wx.GridSizer(6, 5, 10, 10)
        
for msg in range(1,27):
    mytext = str(msg)
    gs.Add(wx.Button(frame0, label=mytext), 0, border=10)
vbox0.Add(gs, proportion=.3, flag=wx.TOP)
frame0.SetSizer(vbox0)

#=========================================================================================        
vbox1 = wx.BoxSizer(wx.VERTICAL)

gt = wx.GridSizer(6, 5, 15, 15)
        
for msg in range(1,27):
    mytext = str(msg)
    gt.Add(wx.Button(frame1, label=mytext), 0, border = 15)
vbox1.Add(gt, proportion=.9, flag=wx.TOP)
frame1.SetSizer(vbox1)
With this the BoxSizer in frame0 ( my laptop ) appears correctly but the other one has half the column of buttons on the left obscured but not showing on my laptop screen.
Running
import wx
myapp =wx.App()
for idx in range(wx.Display.GetCount()):
    d = wx.Display(idx)
    print( d.IsPrimary(), d.GetGeometry())
Shows the screens as 1336 x 768 ( laptop )
and 1920 x 1080 ( T.V )
altering the code for the T.V as
frame1 = wx.Frame(None, -1, size=(1860,1080), pos=(2100, 0))
frame1.SetTitle('Frame 1')
#frame1 = wx.Frame(None,-1,"Display %d"%display_num, geometry.GetTopLeft(),geometry.GetSize())
frame1.Show()
I have to position the vbox way over to the right of where I expect it should be so all columns of buttons show correctly.
I expect I am doing something wrong but I hope someone can say what that is.
Any ideas please?
Quote
#2
I made a mistake with the above. In fact with my second way of placing the vbox using pos it does display correctly. This is true with python 3.5.3 and 3.64
Quote

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  Problems using Wxpython Carles 1 251 Nov-28-2018, 03:09 PM
Last Post: Larz60+
  [WxPython] Using thread in the wxPython hildogjr 8 963 Aug-11-2018, 02:59 AM
Last Post: hildogjr
  Trying to use code from WxPython GUI Toolkit Barrowman 3 611 Jun-26-2018, 05:43 PM
Last Post: nilamo
  A little idea to remember wxPython classes Sebastian_Adil 0 612 Mar-26-2018, 10:23 PM
Last Post: Sebastian_Adil
  moving from tkinter to wxpython Barrowman 95 9,776 Mar-25-2018, 12:39 AM
Last Post: Larz60+
  how to draw simple line in wxPython? Sebastian_Adil 6 1,001 Mar-22-2018, 08:34 PM
Last Post: Larz60+
  installing wxPython predirt 12 2,164 Mar-16-2018, 09:45 PM
Last Post: Barrowman
  [WxPython] wxpython and python 3.6 on linux Barrowman 3 1,662 Mar-15-2018, 06:57 PM
Last Post: Larz60+
  WxPython Line Number QueenSvetlana 0 637 Dec-14-2017, 03:42 AM
Last Post: QueenSvetlana
  wxPython wxListBox Contains QueenSvetlana 1 678 Nov-11-2017, 04:12 PM
Last Post: snippsat

Forum Jump:


Users browsing this thread: 1 Guest(s)