cannot set position of wx.frame on openbox

294 views Asked by At

i am playing with wxPython and try to set position of frame:

import wx

app = wx.App()
p = wx.Point(200,  200)
frame = wx.Frame(None, title = 'test position', pos = p)
frame.Show(True)
print('frame position: ', frame.GetPosition())

app.MainLoop()

even though print('frame position: ', frame.GetPosition()) shows the correct postion, the frame is shown in top left corner of screen. Alternatively i tried

frame.SetPosition(p)
frame.Move(p)

without success.

my environment: ArchLinux 5.3.13, python 3.8.0, wxpython 4.0.7, openbox 3.6.1

On cinnamom the code works as expected. How to solve this on openbox?

edit 07,12,2019: i could set postion of a dialog in openbox config ~/.config/openbox/rc.xml:

<application name="fahrplan.py"
            class="Fahrplan.py"
        groupname="fahrplan.py"
       groupclass="Fahrplan.py"
            title="Fahrplan *" 
             type="dialog"> 
  <position force="no"> 
    <x>760</x> 
    <y>415</y>
  </position>               
</application>

i got name, class etc. from obxprop. x and y are calculated to center a dialog of 400 x 250 px on screen of 1920 x 1080 px.

This static solution is not suitable for me. I want to place dynamically generated popups.

2

There are 2 answers

0
RobinDunn On

The position is provided to the window manager as a "hint". It is totally up to the window manager whether it will actually honor the hint or not. Check the openbox settings or preferences and see if there is anything relevant that can be changed.

1
V15I0N On

I had the same problem under Windows and played around with the style flags. With wxICONIZE sytle set active the window finally used the positioning information