self.w.resize() pushes FloatingWindow on top (only on second screen)
Hi! Consider this demo:
from vanilla import *
MARGIN = 8
BOTTOM_MARGIN = MARGIN*2
class MyDemo(object):
popOptions = ('one', 'two')
def __init__(self):
self.w = FloatingWindow((0, 0, 200, 300), 'MyDemo')
self.jumpingY = 10
self.w.myPop = PopUpButton((10, self.jumpingY, -10, 20),
self.popOptions,
callback=self.myPopCallback)
self.jumpingY += MARGIN + 20
self._initCtrlsModeOne()
self.w.resize(200, self.jumpingY+BOTTOM_MARGIN)
self.w.open()
def _initCtrlsModeOne(self):
self.w.buttonOneAA = SquareButton((10, self.jumpingY, -10, 30),
'AA')
self.jumpingY += MARGIN + 30
def _delCtrlsModeOne(self):
delattr(self.w, 'buttonOneAA')
self.jumpingY -= MARGIN + 30
def _delCtrlsModeTwo(self):
delattr(self.w, 'buttonTwoBB')
delattr(self.w, 'buttonTwoCC')
self.jumpingY -= (MARGIN + 30)*2
def _initCtrlsModeTwo(self):
self.w.buttonTwoBB = SquareButton((10, self.jumpingY, -10, 30),
'BB')
self.jumpingY += MARGIN + 30
self.w.buttonTwoCC = SquareButton((10, self.jumpingY, -10, 30),
'CC')
self.jumpingY += MARGIN + 30
self.w.resize(200, self.jumpingY)
def myPopCallback(self, sender):
if self.popOptions[sender.get()] == 'one':
self._delCtrlsModeTwo()
self._initCtrlsModeOne()
else:
self._delCtrlsModeOne()
self._initCtrlsModeTwo()
self.w.resize(200, self.jumpingY+BOTTOM_MARGIN)
if __name__ == '__main__':
md = MyDemo()
It is an example for a possible scenario. I have a tool, this tool has a popUpButton() on top which defines the usage mode. Different modes (for example, “place anchors”, “build accents") need different controls below the popUpButton(). Different controls, different window size needed. Therefore I use self.w.resize() to adjust the window height. The issue is: if the tool is placed on my second screen, the method moves the tool on top of the screen.

I am on MacOS 10.13.3
Thanks!
window.resize is round tripping posSize with window.getPosSize and window.setPosSize
there is something wrong when the screen is not the main screen
see https://github.com/typesupply/vanilla/blob/master/Lib/vanilla/vanillaWindows.py#L376-L377
not reproducible on 10.10
Actually, it is reproducible on 10.10, if your screen arrangement looks like this:

I bet is has to do with this chunk of code:
https://github.com/typesupply/vanilla/blob/750a336f2acc2d30bbc6f3c92bcdcb8c21e24573/Lib/vanilla/vanillaWindows.py#L343
In the arrangement shown, t (the top coord) can legitimately be negative, and vanilla does the wrong thing here (I think).
This bug occurs also on normal windows and also if using setPosSize()
could you elaborate your setup? osx version? setup of different screens?
All he's saying is that it's not just the FloatingWindow, also a normal vanilla Window. I've shown earlier how to replicate on multiple screens.
Just to make sure: macOS 10.12.6
My display settings aren't negative on the second screen.

I was about to make an example gif and just encountered two important things to note:
- If there are two windows the second window will fail to resize
TypeError: resize() takes exactly 1 argument (2 given)(Maybe the vanillaBase and vanillaWindows-resize functions interfere?) - The resize bug will only occur if the application is launched from the second screen. I started the application on my main screen, then moving it to the secondary and the bug did not occur. So it is depending from which screen it was started.
@justvanrossum I got the feeling this bug lays deeper due to my screen setup and the launch-placement.
Just ran into the same issue. I am on macOS 10.14.6.
I am changing the height of a Window on my second screen. Everything seems fine when the second screen is below my main screen (widows's y coordinate is positive)

The windows gets unexpectedly stacked to the top of the screen when the second screen is above the main screen (widows's y coordinate is negative)

Nothing critical though 😊