Backend for embedded matplotlib in cocoa - python

Sorry for the novice question but I was wondering if anyone knows about embedding matplotlib plotting functions into a cocoa app? I have been able to open a plot within the app using the cocoa backend but every time I close the plot window the entire app closes (I assume its stopping the run loop). I have done some investigating a realise that the cocoa backend was originally designed for implementation into apps but it appears it is still taking over the run loop. I would like to avoid using bitmaps and NSImage if possible as this removes the interaction capabilities of matplotlib, which are very useful to me.
Many thanks!

Related

GUI type application for Scheduling Jobs

Is there any Python library or framework that provide scheduling of Jobs in windows having GUI. By jobs, I mean some batch files or Python scripts.
An application where edit, create and deletion of jobs are available.
I have tried and looked a lot of questions, and finally mashed up.
Please suggest some library or a way to create one GUI application for the same.
I used Tkinter and PyQt5 .What I really recommend is PyQt5 for many reasons:-
1.Easy syntx
2.More human readable
and lastly there is an application created to ease and save time on designing the app
for PyQt5 which is Qt designer it's going to convert all the look of you application into python codes so all you have to do copy , paste and do the functionality like when clicking a button something happens etc. Highly recommend PyQt

Displaying pyqtgraph and pyqt widgets on web

Is there a way to take existing python pyqtgraph and pyqt application and have it display on a web page to implement software as a service? I suspect that there has to be a supporting web framework like Django in between, but I am not sure how this is done.
Any hints links examples welcome.
If all you need are static plots, then it should be straightforward to draw and export to an SVG file, then display the SVG in a webpage (or export to image, as svg rendering is not reliable in all browsers). If you need interactivity, then you're going to need a different solution and probably pyqtgraph is not the tool for this job. VisPy does have some early browser support but this has only been demonstrated with ipython notebook.
Here is what I have sort of put together by pulling several threads online:
Ruby On Rails seems to be more popular than python at this moment.
If you go python, Flask and Django are good templates.
bokeh seems to be a good way of plotting to a browser.
AFAIK, there is no way to take an existing PyQt or pyqtgraph application and have it run on the web.
I am not sure how Twisted (Tornado, Node.js and Friends) fits in to the web SaaS, but I see it referred to occasionally since it is asynchronous event-driven.
People often suggest using Rest, but that seems slow to me. Not sure why...

how to display matplotlib plots on local machine?

I am running ipython remotely on a remote server. I access it using serveraddress:8888/ etc to write code for my notebooks.
When I use matplotlib of course the plots are inline. Is there any way to remotely send data so that plot window opens up? I want the whole interactive environment on matplotlib on my local machine and all the number crunching on the server machine? This is something very basic....but somehow after rumaging through google for quite a while i can't figure it out.
The upcoming release (1.4.0, should be out by end of August 2014, release candidates are available) will ship with the nbagg backend which provides interactive figures with out needing to go to native clients or resorting to using d3. All you need to do in your note book is:
import matplotlib
matplotlib.use('nbagg')
from matplotlib import pyplot as plt
And then to plot
plt.plot(range(3))
plt.show()
If you want to try this now either build from source or look at one of the release candidates.
There are two major difference between using nbagg and mpld3/bokeh.
First, you don't have interface across library interfaces (or learn js!). My understanding is that both of them create a figure, scrap it (which isn't perfect because mpl was not designed with making this easy in mind). With nbagg mouse and keyboard call backs should work with no translation, I don't think they can currently be exported to d3.
The second is that with nbagg all the rendering happens on the server, with the d3-based libraries all of the data must be naively shipped to the browser (bokeh is working on making this smarter and only shipping you data you can see at a useful resolution). With nbagg the only thing that comes across the network is png deltas.
There are a few possibilities
If your remote machine is somehow unixish, you may use the X Windows (then your session is on the remote machine and display on the local machine)
mpld3
bokeh and iPython notebook
nbagg backend of matplotlib.ยจ
Alternative #1 requires you to have an X server on your machine and a connection between the two machines (possibly tunneled through ssh, etc.) So, this is OS dependent, and the performance depends on the connection between the two machines.
Alternatives #2 and #3 are very new but promising. They have quite different approaches, mpl3d enables the use of standard matplotlib plotting commands, but with large datasets bokeh may be more useful.
Alternative #4 is probably the ultimate solution (see tcaswell's comments), but not yet available without using a development version of matplotlib (i.e. there may be some installation challenges). On the other hand, if you can hold your breath for a week, 1.4.0 will be out.
You want to get the regular (zoomable) plot window, right? I think you can not do it in the same kernel as, unfortunately, you can't switch from inline to qt and such because the backend has already been chosen: your calls to matplotlib.use() are always before pylab.

Using Matplotlib Output Client-Side in Browser With Skulpt

I am writing a Python application to be run client-side within the browser. The Skulpt project looks great for this, and I am pretty excited to begin working with it.
The one issue I can foresee, however, is that I will need graphical output using Matplotlib. Does Skulpt support Matplotlib? If not, what other options do I have?

Blender3d vs 3DS max; which one is better suited for automation in python?

I am getting started with the development of 3d environments for using in panda3d. As I am new to this, I need to choose a modelling software to create basic geometries, etc. Therefore, which one is better suited for automation through python? 3DS Max or Blender3D? I would like to automate generating basic geometries, the export process and some basic animations. Blender has the benefit of being free, but my office will provide me the licenses for 3DS if I request, so that is not a problem.
From a python automation point of view, blender itself is written largely in python, and the source is available which allows a level of automation not possible if you can't change the source. To me, having the source available in that situation is more of a benefit than the price tag.
If you do go with blender, definitely grab the 2.5 beta. They made some huge UI and scripting improvements. In my opinion, most of the complaints about it being difficult to learn compared to commercial packages are no longer valid for 2.5, especially if you don't have the mental burden of already having learned another software's interface.
Actually the poster Karl Bielefldt is wrong. Blender is not written in python is written in C. What is written in python is some script tools, python is used as blender's script engine , but in the end what is triggered are C libraries. That is not big deal though since python itself is written in C.
However all this is totally unrelated to your question.
Since the engine you are going to use is third party and not the game engine of blender, there is no reason for you to consider Blender as a mandatory choice. Any 3d package can serve you well. This is because as other kind of software, 3d software has several formats that are common ammong 3d apps. Like *.3ds and *.obj . So that means that you can use anything you wish like Maya, XSi, Ciname 4d , anything. As almost 3d software saves to these common file formats.
However I would strongly advice to take a look at blender game engine. The blender game engine automates alot of things and has a gui inside blender that minimises coding unlike Panda 3d which requires everything to be coded regarding the engine.
You can save loads of time with blender's game engine.
There is even a blender game that was developed using solely with the blender game engine , its called project apricot or Yo Fankie.
Apricot Project
You can download it for free and see the source to help you learn loads of things for Blender Game engine.
Good luck.

Categories