Background: I am using VTK 6.1 with Python 2.7 and want to define my own OpenGL shaders. In VTK 6 onwards the way to do this has changed, and it should now be done using vtkShader2 rather than XML files. VTK provides wrappers for most of the underlying functionality of the C++ code using a semi-automated process which is documented here.
My problem: is it possible to access vtkShader2 from Python?
Tried so far:
I haven't found anything on the online documentation for the Shader2 class
vtkShader2 doesn't seem to exist when exploring the module using pydoc
A relevant post on the official vtk users mailing list was asked in 2012 but hasn't been answered...
No mention of shader issues on the official Python Wrapping FAQ (though the page seems targeted at VTK pre-5.6)
Any suggestions would be very welcome. If vtkShader2 can be accessed, then that would be great! If it can't be accessed, then it would be useful to know so that I (and others) can work around it...
Related
PyCharm (PY-193.6911.25, macOS 10.15.4) doesn't correctly display the OpenCV documentation.
More concretely, this is the result.
As you can see, it's a mess. Is it possible to fix this? I installed OpenCV with pip.
After googling a lot I ended up thinking there is no easy solution but... there actually is!
What i did is:
Push CTRL Q
Scroll down to the trippledot and click open source.
Push CTRL+R(replace)
replace '. ' to ''
Now docstring looks like this:
Definately not perfect, but i think it looks a bit better.
Additionally i added this as external documentation:
https://opencv-python-tutroals.readthedocs.io/en/latest/search.html?q={element.name}&check_keywords=yes&area=default
So it brings up a cv2 'tutorial'...
In PyCharm 2020.1.1 professional edition with Python 3.7, the following warning is displayed for the cv2 docstring
You need configured Python 2 SDK to render Epydoc docstrings
Epydoc is a tool for generating API documentation for Python modules, based on their docstrings.
Pycharm can't render Epydoc docstrings
The suitable interpreter is looked up among those configured in the IDE (it has to be Python 2 since Epydoc package itself hasn't been ported to Python 3 yet). In other words, you need to set up it once so that it showed up on the list at Settings | Project: ... | Project Interpreter | Show All... -- it doesn't need to be actually used in any project. Is it true in your case?
The problem is that it's not really Epytext. OpenCV uses Doxygen for documentation that we don't support and also confuse with Epytext because of the similarity of tags. There is an open issue about it.
Doxygen is confused with Epydoc and displayed as free text (not preformatted)
I'm afraid this particular feature of PyCharm is not really extensible at the moment. Besides, displaying of documentation, injecting references to symbols inside it, completion of available tags and generation of documentation stubs -- everything is tied very closely to the fact that in Python code documentation is normally provided via designated string literals, not comments. The highest level API you can plug into to provide custom documentation source for Quick Documentation popup/tool window is com.intellij.lang.documentation.DocumentationProvider if you register yours before the default one with ID pythonDocumentationProvider. But it will cover only rendering, everything else will need to be written from scratch.
The official resolution is we don't support that
OS: CentOS 6 (64bit)
I have a dynamic library (.so) in C. And I want to create an abstraction layer of Python over it and then use it to implement my logic. I have decided to use CFFI for this since it doesn't deal with any kind of dsl (domain specific language).
Couple of things I wanted to know:
Is there some good starting point which I can refer for doing this (loading and using dynamic libraries using cffi)? The docs on the official site talk about this, but I was looking if there was some concrete reference somewhere with some examples. Or someone who might have tried it.
Can there a possible drawback to this approach?
Thanks
Two good starting points:
The CFFI documentation, and specifically the ABI out of line example: https://cffi.readthedocs.org/en/latest/overview.html#out-of-line-example-abi-level-out-of-line
My CFFI example repository: https://github.com/wolever/python-cffi-example
Between the two you shouldn't have too much trouble putting together your wrapper.
And to your second question: if the shared library you're wrapping is very simple (ex, a few function calls, simle data structures) you might find ctypes simpler (as it's part of the standard library).
I'm trying to create a means to display QR codes on a small display using a Telit GE-865 as the main controller. In short, the Telit would receive an sms and spin that string out to a display in the form of a QR code. I've found a few different python QR code library's (most from the fukuchi ports), but I'm not exactly sure if they can be imported into a Telit module. If anyone has any experience running python on the Telit modules I'd love to hear your experience and get your thoughts on whether this is feasible or not.
Thanks in advance!
Yes, sorry. Forgot to elaborate a bit. My specific concern is that the scripts Telit provides for examples reference a 1 version of Python. Everything in the QR Encoding library that I've been finding usually require 2.6 or later. I'm not sure if the Telit module can handle a QR encoding script or not with it's PIL library. I'm really just trying to wrap my head around it all before I start figuring out how to actually load the libraries onto the module. I also found this site that seems to have a decent amount of info on this topic. link – user1667373
This device uses a customized version of Python 1.5.2. You may need to back-port whatever library to are using to work with this older version of Python. Note also that not all standard Python modules are available, and floating point math is not supported.
See section 5 of the "Telit Easy Script in Python" manual for details of what is and is not included. You can find it here: http://www.telit.com/en/products/gsm-gprs.php?p_id=12&p_ac=show&p=47
I am new at writing APIs in python, in any language for that matter. I was hoping to get pointers on how i can create an API that can be installed using setup.py method and used in other python projects. Something similar to the twitterapi.
I have already created and coded all the methods i want to include in the API. I just need to know how to implement the installation so other can use my code to leverage ideas they may have. Or if i need to format the code a certain way to facilitate installation.
I learn best with examples or tutorials.
Thanks so much.
It's worth noting that this part of python is undergoing some changes right now. It's all a bit messy. The most current overview I know of is the Hitchhiker's Guide to Packaging: http://guide.python-distribute.org/
The current state of packaging section is important: http://guide.python-distribute.org/introduction.html#current-state-of-packaging
The python packaging world is a mess (like poswald said). Here's a brief overview along with a bunch of pointers. Your basic problem (using setup.py etc.) is solved by reading the distutils guide which msw has mentioned in his comment.
Now for the dirt. The basic infrastructure of the distribution modules which is in the Python standard library is distutils referred to above. It's limited in some ways and so a series of extensions was written on top of it called setuptools. Setuptools along with actually increasing the functionality provided a command line "installer" called "easy_install".
Setuptools maintenance was not too great and so it was forked and a more active branch called "distribute" was setup and it is the preferred alternative right now. In addition to this, a replacement for easy_install named pip was created which was more modular and useful.
Now there's a huge project going which attempts to fold in all changes from distribute and stuff into a unified library that will go into the stdlib. It's tentatively called "distutils2".
I have installed PyQt GPL v4.6.2 for Python v3.1 and Qt by Nokia v4.6.0 (OpenSource), but the documentation in PyQt is not coming up. Example docs are all blank, too.
Would anyone mind writing a step-by-step guide on what links to visit and what procedures must be executed in order to get text to come up for the PyQt documentation?
Edit: The programs are running on Windows, and the documentation is not coming up in PyQt GPL v4.6.2 for Python v3.1 > Examples > PyQt Examples and Demos and PyQt GPL v4.6.2 for Python v3.1 > Assistant. What needs to done to let both programs access the docs?
Some out of date answers here. Best resources are:
The Reference Guide
and
The Class Reference Guide
Not sure about the standalone docs, but have you also looked at (this post is a cw, so feel free to edit):
PyQt's Classes, adapted from the documentation provided with Qt4.
and
GUI Programming with Python: QT Edition?
The last one has some really deep and helpful (at least to a novice I think) advice (for example: Python Objects and Qt Objects) while being a free book.
Whenever I need to look at documentation, I just search Google for the specific widget I am interested in. For example: QTreeWidget. Sometimes you get an older version of Qt, but if you click the "similar" link in the search result, you can pretty much always find the page you are looking for.
The PyQt documentation is exactly as provided on the website, and as
included in the installer. It is not integrated with Assistant (it will be
in a future version). If you want to use Assistant then you can use the Qt
documentation instead (a lot of people do) and translate between C++ and
Python as you read it.
If you installed the Qt documentation, you should have an app named Assistant. This is a simple-minded browser for a local copy of the Qt doc as found at doc.qt.nokia.com. It is written for C++ but the mental translation to Python is not difficult, and it is nicely formatted and richly cross-linked. I keep Assistant running all the time I'm coding in PyQt4 and find it very helpful.
The PyQt doc, as given at www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/classes.html, is merely this same Nokia text with its formatting and many of the internal links stripped out and edited to python class and function syntax.