enthought / enthought/traitsui

Traits UI places windows incorrectly depending on external monitor arrangement

Open
#807 3 comments 0 reactions 0 assignees View on GitHub
type: bug
Dominant language
Python
Stars
306
Forks
99
PR merge metrics
No merged PRs in 30d

Description

_This might be macOS specific, but it also might not be._

I have an external monitor attached to my laptop with the laptop screen set as the "main" screen. This is the arrangement:
negative

With the above arrangement, if I'm using an application on the external screen (left screen) and the application opens a child window with `instance.edit_traits(kind='livemodal', parent=parent)`, then the window shows up with it's top-left corner at screen position `(0, 0)` on the main screen (right screen). If no `parent` is provided, it shows up in the middle of the main screen (right screen).

However, if I use the following arrangement:
positive

Suddenly everything works as it should. Child windows open on the external screen (right screen) centered over their parent.

I believe the culprit is this code: https://github.com/enthought/traitsui/blob/dfaa5a0b6543d56e000318539af35bb96a2d1d01/traitsui/qt4/toolkit.py#L306-L313

Wrapping coordinates with `max(0, coord)` is getting the wrong result when a position is negative.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.