Hello NG,
always regarding the porting of C++ code to Python, I am having problems
in a OnPaint function. Essentially, I need to draw some horizontal lines.
These "lines" are stored in self._items, together with other windows (that
I don't care of, I need only the lines). These lines have some properties
like GetLineY(), GetSpacing() and so on, but that's not relevant. The coordinates
with which I call DrawLine() are correct.
This is my OnPaint() call:
def OnPaint(self, event):
"""Handle the EVT_PAINT event in the FoldPanelItem. """
# draw all the items that are lines
dc = wx.PaintDC(self)
vertical = self.IsVertical()
for i in range(0, len(self._items)):
item = self._items[i]
if item.GetType() == "SEPARATOR":
pen = wx.Pen(item.GetLineColour(), 1, wx.SOLID)
dc.SetPen(pen)
a = item.GetLeftSpacing()
b = item.GetLineY() + item.GetSpacing()
c = item.GetLineLength()
d = a + c
if vertical:
dc.DrawLine(a, b, d, b)
else:
dc.DrawLine(b, a, b, d)
event.Skip()
The problem is that, when I resize the window, the lines are redrawn but
they appear corrupted (discontinuous), with some blank space in a single
line, like in this small representation:
_______________ ___ __ ________ ___ _
The effect disappears if I minimize and then maximize my main frame.
Does anyone have some suggestions/pointers?
Thank you a lot.
Andrea.