klampt.vis.qtbackend module¶
-
class
klampt.vis.qtbackend.
QtBackend
[source]¶ Backend implementation of OpenGL visualization using Qt. Usually hidden from the user.
To use as a standalone program: Set up your GLProgramInterface, call createWindow to construct new windows and setProgram to set the GLProgram used in that window. Then call run() to start the Qt main loop.
-
class
klampt.vis.qtbackend.
QtGLWindow
(name='OpenGL window', parent=None)[source]¶ Bases:
PyQt5.QtOpenGL.QGLWidget
A basic OpenGL window using Qt. Should not be used directly, use the functions in QtBackend instead.
-
name
¶ title of the window (only has an effect before calling run())
Type: str
-
width, height
width/height of the window in screen units. These are initialized from the GLProgram viewport on run(), but thereafter Qt manages them. After, the user must call resize(w,h) to change the dimensions.
Type: int
-
devwidth, devheight
width/height of the window in OpenGL device pixel units (Note that these may be different from the screen dimensions due to Retina displays)
Type: int
-
clearColor
¶ the RGBA floating point values of the background color.
Type: list of 4 floats
-
add_action
(hook, short_text, key, description=None)[source]¶ This is called by the user to add actions to the menu bar.
Parameters: - hook (function) – a python callback function, taking no arguments.
- short_text (str) – the text shown in the menu bar
- key (str) – a shortcut keyboard command (can be ‘k’ or ‘Ctrl+k’)
- description (str, optional) – if provided, this is a tooltip that shows up when the user hovers their mouse over the menu item.
-
close
()[source]¶ Qt thread should call close() after this widget should be closed down to stop any existing Qt callbacks.
-
draw_text
(point, text, size=12, color=None)[source]¶ Renders text at the given point (may be 2d or 3d). Frontend should call this to draw text in either the display or display_screen method.
Parameters: - point (list of floats) – either a 2d or 3d point at which to draw the text
- text (str) – the text to draw
- size (int, optional) – if given, it renders a font in the given size.
- color (list of 3 floats or list of 4 floats) –
-
idlesleep
(duration=inf)[source]¶ Externally callable. Sleeps the idle callback for t seconds. If t is not provided, the idle callback is slept forever
-
idlesleep_signal
¶
-
initialize
()[source]¶ Opens a window and initializes. Called internally, and must be in the visualization thread.
-
refresh_signal
¶
-
reshape_signal
¶
-