I am trying to make a GUI in python (tkinter). I have successfully created the application such that I have a scene rendered by POV-ray. I press button "move to left" and this changes the camera location in the .pov file, re-renders the scene and shows it in the GUI(same for rotation and zoom in/out).
But I would like to make interactive. i.e use mouse to interact with the scene completely just like a matplotlib 3D graph but for ray-rendering.
How to go about solving this problem ?
The Scenes have values of location as
Img_1 location <0,0,-10>
Img_2 location <0,-10,-10>
Img_3 location <25,0,-10>
PS
I am not trying to import matplotlib plot in my GUI. It is just for refrence to share what I want to achieve with my rendered scenes.
[
]img11
[
]img22
[
]img33
You can use mouse events
<Motion>and<Button-1>, (and others) to run functions which will change content in window.EDIT: Examples show how to use
bind()to run functions when you use mouse and how to calculatediff_x,diff_yto move objects. You have to uses own functions withbind()which will usediff_x,diff_yto move POVRay camera and render new image. And then you will have to replace image on canvas. But I will use canvas objects instead of POVRay to show how it can change when mouse is moving.This example moves rectangle when you move mouse, and it changes color when you click button.
But you can run functions which move, zoom or rotate rendered image.
EDIT: Example which uses
<B1-Motion>,<Shift-B1-Motion>,<Control-B1-Motion>to move objects:left mouse button),Shift+left mouse button)Control+left mouse button).Code: