Graphics library to draw images to screen for python - python

I would like to know if there is a good graphics library for python that will allow me to write a console/terminal application in which I can draw images and or shapes similar to libraries that are available in C++. My applications will be developed for linux primarily but will likely also be made available for windows but it ultimately not necessary.

I already used the following libraries that offer this type of resource:
Tkinter
wxPython (https://www.wxpython.org/) - you can use it to draw shapes or images and there are a lot of built ins resources to create GUI
Pygame (https://www.pygame.org/news) - it's very useful to do physics simulations, you can use built in function to draw circles, blit images into the screen, access keys inputs, etc.
Matplotlib (https://matplotlib.org/) - this is good to mathematical purposes to draw graphs, but you can animate the graphs too
The Pygame help and docs is not user friendly (my think), but the learning curve is fast.

Related

2d graphics in Python Kivy, advice is needed

I still have been studying world of Kivy and I have encountered with question. I am designing an interface. it has to have an appearance of analog device with arrow and curved scale like old voltmeters were. Just to display a data on the screen. I've tried to use canvas, but I stacked with resizing of window properties. Built canvas object was either connected to specific size in px, or changed location on the screen in wrong way. So, I am curious, maybe here are some others ways to embed objects which were built in another 2d graphics library, I am aware of existence of 3d module vpython and turtle. Maybe we have some more?
Can anybody give me a hint? I would be very grateful
kivy, canvas
view of my prototype
You can use Image widgets combined with Button Behavior or ToggleButton Behavior to make buttons that look like almost any kind of button that you like. And you can make a curved scale as described in this question.

matlab's imshow3d mouse scrolling image visualization in python

Currently, I am trying to build a User Interface with python to visualize MRI images (in numpy) in 'tkinter' Graphic User Interface.
The feature of mouse scrolling from Matlab's imshow3d is essential but I was not able to find anything like this on web (ex.https://www.mathworks.com/matlabcentral/mlcdownloads/downloads/submissions/47463/versions/3/screenshot.jpg).
Does anyone have any idea how I can implement the mouse based slice browsing with tkinter?
or are there any other gui that I could use to build what I want.

Drawing Video Canvas In Python

I am not really sure where to start on a project. I designed a channel for the Roku using Brightscript over the past several months. I now need to design a similar project for a different device but using Python. I don't know a lot about Python, but from what I have read it looks fairly easy to learn. My question is in Brightscript I had to draw a canvas passing certain parameters like size, location and color. This essentially was the video player. In Python to create a video player, do you have to draw a canvas or the like? Brightscript comes with components like roVideoPlayer where the code passes needed information into this object. Are there modules for Python that can be imported that create the components?
Thanks for advice

Render 3D model orthographically in Python

I want to write a tool in Python that will help me create isometric tiles from 3D-models. You see, I'm not a very proficient artist and free 3D-models are plentisome, and creating something like a table or chair is much easer in 3D than in painting.
This script will load a 3D model in orthographic projection and take pictures from four directions so it can be used in a game. I've tried this in Blender, but the results are inconsistent, very difficult to control and take very long time to create simple sprites.
Rolling my own script will probably let me do neat things too, especially batch-genetration, maybe on texture changes, shading, etc. The game itself will probably be made in Python tpp, so maybe I could generate on the fly. (Edit: and automatically creat cut out see-through walls for when they face camera)
Now my question, what Python libraries can do something like this? I've checked both Pyglet and Panda3D, but I haven't even been able to load a model, let alone set it to orthographic projection.
I found this code:
www.pygame.org/wiki/OBJFileLoader
It let me load and display an .obj file of a cube from Blender with ease. It runs PyOpenGL so it should let me do everything OpenGL can. Never knew OpenGL was so low-level, didn't realize I'd have to write my own loaders and everything.
Anyway, I'm pretty sure I can modify this to project isometrically, rotate the object and grab shots and combine them into sprites. Thanks you guys!
Since you looked at Panda3D - if you can convert your model to the 'egg' format (which blender/maya may do), then you could be able to import it.
https://www.panda3d.org/manual/index.php/Loading_Models
https://www.panda3d.org/manual/index.php/Models_and_Actors
http://www.panda3d.org/manual/index.php/Converting_from_Blender
Note: sources of this was 'python 3d mesh loader' in a popular search engine - this looks viable to me. I now need to try installing it and some code...

Basic Python 2D graphics?

I'm looking for a Python 2D graphics library that can basically do the following and not necessarily anything more:
Create a window of specified width and height
Set the RGB of pixel X, Y on the back buffer.
Swap buffers
...and that's it basically. I can't find anything that doesn't come with a massive amount of complex baggage.
I recommend PyQt for this - it's a GUI library/framework but it has very good drawing capabilities. If you look at the examples coming with PyQt, focusing on the graphics & drawing samples, it's quite amazing what you can do with very few lines of code.
Oh, and it does the double-buffering you mention automatically so you don't have to worry about it.
Alternatively, you can use PyGame - a library wrapping SDL, used for game development. Naturally it has very strong 2D graphics capabilities.

Categories