Phoenix
Phoenix copied to clipboard
Moving Rows in Grids Is Not Possible
Operating system: Windows 10 wxPython version & source: 4.2.0 Python version & source: 3.10
Description of the problem:
If you create a grid and use the option to move rows in the grid (concretely this is the wxEvent EVT_GRID_ROW_MOVE
in gridmovers
.), then an error occurs as soon as you try to swap two rows where one of them is not located the visible area of the window. One would expect that if you try to move the mouse to the lower edge of the windows, also in the window in the table is scrolled down. This is actually implemented, in the function OnMouseMove
in the class GridRowMover
in gridmovers
. The problem here is that the value of y
in the line self.grid.Scroll(x,y)
is expected as an integer, but in this case is passed as a float. If you round the value of y
to the nearest integer, then it is possible to perform the desired action.
The error that appears is the following:
ScrolledCanvas.Scroll(): arguments did not match any overloaded call:
overload 1: argument 2 has unexpected type 'float'.
overload 2: argument 1 has unexpected type 'int'.
Frame OnMouseMove in C:\Users...\venv310\lib\site-packages\wx\lib\gridmovers.py at line 423 self = <wx.lib.gridmovers.GridRowMover object at 0x0000021B6EBA8790> evt = <wx._core.MouseEvent object at 0x0000021B6EC3EF80> _clSize = 32 uy = 15 x = 0 sy = 0 w = 82 h = 264 y = 0.06666666666666667
Could you please try one (or both) of these:
There is a new method to move rows and columns.
See e.g. here: https://docs.wxpython.org/wx.grid.Grid.html#wx.grid.Grid.EnableDragRowMove
The related events are wx.grid.EVT_GRID_ROW_MOVE
, wx.grid.EVT_GRID_COL_MOVE
Post a minimum runnable sample of the failing code here?