Qt gui implementation site

How do you embed vpython graphics (animated) into your Qt GUI? so it has its own display area and no longer needs to create a new window.

+2


source to share


2 answers


The vpython FAQ states that the vpython architecture makes any nesting a problem ...:

Q: Is there a way to embed VPython in a different environment?

This is tricky because VPython has two threads, your compute thread and a render thread, which paints the scene about 25 times per second using the current attributes of the graphics objects. However, Steph Mientki managed to inject VPython into a wxPython window on Windows; see the section provided.

So if it takes a heroic effort with wxPython ("succeeded" doesn't seem like a trivial achievement ;-) And only works on one platform, I'm afraid with Qt ... one tough, complex slogan on each platform separately.



If you are ready for a serious challenge, deeply familiar with vpython, reasonably familiar with Qt, and familiar with the basic window-level architecture on all platforms you are interested in (and minor in wxPython), the place to start Mientki is an amazing contribution. It actually works well below the wxPython abstraction level and in terms of calls win32gui

, constants win32con

, plus "a state machine synchronized with wx.Timer" after 100 milliseconds (although he admits that the result from the last Frankenstein operation ... "is not ideal ";-). Extremely similar approaches should see you at home (similarly "not perfect") in any other Windows environment, including Qt.

However, no one has yet offered any ports for Mac OS X and none of the many window managers that are popular in Linux and Unix-like architectures (I'm not sure if the feats can only be achieved in xlib as well as in the X11 world these DOs usually need cooperation with the window manager.

So the literal answer to your question is, "with a huge amount of work, requiring a lot of skill and / or incredible persistence, and probably in a platform-specific way that will require reuse on every platform of interest" ... sorry to be a bearer of some pretty bad news, but I prefer to call it what I see it.

+3


source


I contacted the VPython maintainer and he confirmed that he is unaware of any working solution where Visual is embedded in a QT window.



This made me try VTK and so far I am very happy, no problem using VTK within PyQT framework.

+1


source







All Articles