.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "_gallery/other/cube_wx.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr__gallery_other_cube_wx.py: Simple Cube with WX =================== Example showing a single geometric cube. .. GENERATED FROM PYTHON SOURCE LINES 7-45 .. code-block:: default # run_example = false import pygfx as gfx import wx from wgpu.gui.wx import WgpuCanvas app = wx.App() canvas = WgpuCanvas() renderer = gfx.renderers.WgpuRenderer(canvas) scene = gfx.Scene() cube = gfx.Mesh( gfx.box_geometry(200, 200, 200), gfx.MeshPhongMaterial(color=(0.2, 0.4, 0.6, 1.0)), ) scene.add(cube) scene.add(gfx.AmbientLight()) scene.add(gfx.DirectionalLight(position=(0, 0, 1))) camera = gfx.PerspectiveCamera(70, 16 / 9) camera.position.z = 400 def animate(): rot = gfx.linalg.Quaternion().set_from_euler(gfx.linalg.Euler(0.005, 0.01)) cube.rotation.multiply(rot) renderer.render(scene, camera) canvas.request_draw() if __name__ == "__main__": canvas.request_draw(animate) app.MainLoop() .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.000 seconds) .. _sphx_glr_download__gallery_other_cube_wx.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: cube_wx.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: cube_wx.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_