I am working on a project that need me to generate a real time line chart on a separate display.
I'm able to have the real time line chart working on my laptop now but I also want the separate display to show only the line chart (the chart window only), I do not want to make the display as the duplicate of my laptop screen. Is there a way for me to do send the chart through HDMI using Python? Is there any library/ function that would be helpful? If Python won't work, is there any other tool that could be helpful for my case?
Feel free to let me know if you have any question regarding this scenario, any help is appreciated. :)
You can generate a graph with matplotlib. Save it to a specific location with some name.
Then use PyGame/ Tkinter/ PyQt5 to make a "window" to display the image.
Then extend your display. The projector display will have the PyGame/PyQt "window" in full-screen.
I think this is pretty much what you want.
Related
I want to be able to do an animation on After Effect and render the composition in Python on a window. I don't really want to export it because it would take a lot of space on my PC...
I'm writing a (hopefully) short python script. Part of the functionality I need is 'show a grid over the screen when the user presses the set shortcut'. I'd like the grid to look like this:
(Image from this github repo)
I'm struggling to make myself clear to Google. What would be a good choice for a python library that flashed up a grid? (I don't need to be able to click while the grid is up) Ideally without changing the active window... I definately need OSX, and linux would be a nice bonus.
I am working on the following project and I am having really difficulties in finding the right way of doing that. I would like to build in Python (but I am open to other possibilities) a very basic interface that allows the user to draw with the mouse (or the pen if used on a surface laptop) something and then save the image. Ideally I would like this to work on a website or at least in a jupyter notebook (at least I imagine this to be utterly difficult).
Anyone can point me in the right direction? The goal would be to use the images as input to a neural network model to demonstrate its result with real life examples.
I am looking at tk but I don't seem to find much in terms of examples.
Thanks in advance, Umberto
I'd take a look at pyautogui to capture the mouse location then "draw" it in matplotlib -- should be able to do this in a loop. You'll want to watch the tkinter window size to sync the mouse coordinates with the relative location.
Why not just have your script open create a new blank img and automatically open it with paint - then read it on close? Seems easier than creating a drawing GUI.
Have a look at my Github repository which have exactly what you need.
Link : CanvasDraw Repo
Depending on the complexity you could either use tkinter which is a package for complex GUIs or something from the gaming community like pygames. You have user input and graphical output so libraries made for games will do what you want but provide way more stuff then you need. This site might help you: Drawing Libarys
Also the answere draw-on-python-tkinter-canvas-using-mouse-and-obtain-points-to-a-list might help you.
I have written a python application which generates output in graphviz DOT format. I convert the generated file into PNG using the external 'dot' utility and open the generated PNG in an image viewer to visualise the graph.
My application is an interactive command-line tool which allows few operations on the graph like changing the colours of edges based on the edge weights, deleting few nodes, etc. After these operations I generate the DOT file again and convert it to PNG for visualisation.
I came across xdot.py which allows me to embed the interactive viewer into my application. Now I do not have to go to the shell to generate the PNG every time.
I want to take this idea further and build a full-fledged GUI application on top of this. I have few questions regarding this:
Do I have to start from scratch (use wxPython or any other GUI framework)? Use a canvas to display the generated image and refresh it whenever there are operations performed on the graph.
Is there any other package which serves this purpose? I am looking for some package which can edit the graph and just provide me with the ability to bind my graph operations to the mouse events on the viewer.
Any other ideas? Greatly appreciate your inputs.
wxPython can display images very easily using wx.StaticBitmap. Here's a tutorial on the subject:
http://www.blog.pythonlibrary.org/2010/03/26/creating-a-simple-photo-viewer-with-wxpython/
You will probably need to do something like this:
img = wx.Image(filepath, wx.BITMAP_TYPE_ANY)
self.imageCtrl = wx.StaticBitmap(self.panel, wx.ID_ANY,
wx.BitmapFromImage(img))
Then just refresh it whenever you update the image. Depending on your graphing needs, there is the matplotlib project which can be integrated into wxPython.
There is a project that use wxPython and pydot that you might find useful: http://code.google.com/p/pyflowuca/. I saw it mentioned here: http://pythonhaven.wordpress.com/2009/12/09/generating_graphs_with_pydot/
I would like to create a GUI that can read and display "map files". The map files are just text files containg a long list of integers, representing the height above sea level. The user should initially just be able to browse for a text file an hit "Display" or something, which generates a colorfull image
I'm trying to descide what language and libraries to achieve this. Is python + tkinker a way of doing this? Does this sound like a difficult problem?
Thanks for any input!
You can do this by drawing on a tkinter canvas. However, to generate nice looking plots with less effort, you can also display matplotlib plots inside a tkinter app.
See for example embedding_in_tk.py and embedding_in_tk2.py from the matplotlib gallery.