My wxPython application uses wx.ScrolledWindow for the main drawing area - taken directly from the demo and hacked into my needs. When the user double-clicks in the scroll pane, I want to open a dialog box (possibly modal) for editing the parameters of the things they painted. Therefore, I brought the dialogue through the code from another demo:
def OnLeftDoubleClickEvent(self, event):
dlg = TestDialog(self, -1, "Sample Dialog", size=(350, 200),
style=wx.DEFAULT_DIALOG_STYLE,
)
dlg.CenterOnScreen()
val = dlg.ShowModal()
This is just a test, of course. The dialogue itself was defined in one of the demonstrations. In any case, after closing the pop-up window, ScrolledArea moves to a new position, and in Windows mouse events are no longer displayed in the correct coordinates. The offset only happens if you move the popup in such a way that you click the mouse outside the scroll area to close it. Keep in mind that OK and Cancel are in a completely different dialog box than the scroll area. On Linux, the scrolled area appears to move depending on how far outside the area the mouse clicked - and in the same direction. In Windows, the scrolled area moves and gets confused - further mouse clicks will also force it out and (because?) The click is recorded in the wrong place.
, Linux, , , click .
, ?
, ?
EDIT: .
, "" "". , , . , . .
EDIT2: , . , . , , . ? , (?) , . , , . .
EDIT3
, : ScrolledWindow.py , :
from Dialog import *
MyCanvas :
self.Bind(wx.EVT_LEFT_DCLICK, self.OnLeftDoubleClickEvent)
( Dialog):
def OnLeftDoubleClickEvent(self, event):
useMetal = False
if 'wxMac' in wx.PlatformInfo:
useMetal = self.cb.IsChecked()
dlg = TestDialog(self, -1, "Sample Dialog", size=(350, 200),
style=wx.DEFAULT_DIALOG_STYLE,
useMetal=useMetal,
)
dlg.CenterOnScreen()
val = dlg.ShowModal()
if val == wx.ID_OK:
self.log.WriteText("You pressed OK\n")
else:
self.log.WriteText("You pressed Cancel\n")
dlg.Destroy()
Core Windows/Controls "ScrolledWindow". , , , . , "" . .
. ? , , , , . ? Edit2 " "?