OGL and “elbow”-style links

Hello wxPythoneers,

I haven’t asked a question in a long time - and to be honest I am asking now because I am not particularly proficient in OGL (wx.lib.ogl).

I was wondering if anyone had a simple example of creating a few rectangle shapes and connecting them via an “elbow” connection (zigzag style, orthogonal style, I’m not sure what’s the right terminology here).

I have done some experimenting but I’ve not been very successful. In particular - assuming only two shapes - I am interested in how this elbow connection could “switch” attachment point on one of the two shapes when I drag around the other one in the canvas. As a bonus point, if the rectangles are aligned (vertically or horizontally), then there should be no elbow - just a straight line.

Does anyone has an example of this to get me started? Preferably wxPython-only…

Thank you :blush:.

Andrea.

Hello Andrea,

There is something similar in “Gimel Studio", an open source application coded partly in wxPython. However, I don’t think it uses the library you want (ogl).

I’ve also attached a small example in OGL (wx.lib.ogl).

test_wx.lib.ogl.py (3.7 KB)

Best regards

Hello @Zig_Zag ,

Thank you for your answer. I have taken a look at that library and indeed it does not use OGL - and it’s very much geared towards their needs rather than being a general-purpose “OGL-like” tool.

As for the sample, thank you: I do know how to make a basic one with OGL, I was more wondering if anyone could provide a simple sample using elbow-style connections - which remain sensible even after moving around the shapes.

Andrea.

Hi Andrea,

Here’s another attempt without “OGL.”
Perhaps this code will be a starting point for your project?

pseudo_ogl_demo.py (14.2 KB)


Sincerely