Best canvas for drawing in wxPython?

南笙酒味 提交于 2020-01-21 09:03:54

问题


I have to draw a graph of elements composing a topological model of a physical network. There would be nodes and arches, and the latter could be unidirectional or bidirectional.

I would like to capture the clicking events for the nodes and the arches (to select the element and show its properties somewhere), and the dragging events for the nodes (to move them around) and arches (to connect or disconnect elements).

I've done some research and I've narrowed the alternatives down to OGL (Object Graphics Library) and FloatCanvas. I would not like to go down to the DrawingContext, but it is not discarded if necessary.

Which canvas option would you choose?


回答1:


I've tried FloatCanvas, although there has been a lot of work to get everything to work. I've managed to get through mouse interaction things like connectivity, movement, automatic reconnection in case of movement, etc.

FloatCanvas is also quite nice in terms of performance and visual results. Anti-aliasing (1) (2) is also possible to improve them if necessary.




回答2:


It seems that OGL is not being updated, and in general FloatCanvas looks more modern. I don't really know deeply enough the two options.

It seems that event capturing is easier with FloatCanvas. I would try to use it before OGL.



来源:https://stackoverflow.com/questions/2327918/best-canvas-for-drawing-in-wxpython

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!