How do I display function arguments in ipython qtconsole? - python

I'm using IPython qtconsole under windows 7, and when I first write a method name and type the bracket, a popup shows method parameters.
What is the way to display that popup explicitly, once it has disappeared? This is pretty common 'show method parameters' shortcut that I'm talking about, but I've failed to find the shortcut to it after an embarrassing amount of google searches.

In Spyder, try View - Panes - Object inspector. Then type the full name of the function.

I would highly recommend relying on the Python Library Reference rather than any in-IDE tools, at least for functions and classes that are in the standard library. For objects outside those libraries however... it looks like you can type object_name followed by a question mark, that is, object_name?, to get a list of informative details about the object. (Since everything is an object, this presumably includes functions.)
For your specific question, it looks, from the iPython docs, like the TAB key is what you're looking for, but somehow I doubt you haven't already tried that.

Related

How to switch context in Blender python?

Good day,
I'm very new to the Blender API.
Ultimately, I am trying to get the currently selected object. I know this is available bpy.context.selected_objects. However, I'm running my script from a python file and the context object is different. in my current context the selected_objects does not exist.
I've searched around and at most I've been able to find that you can edit in which context some operators are run by overriding their settings. But bpy.context.selected_objects is not an operator.
Perhaps there is a method or operator inside bpy.data which returns the selected object? I can't seem to find the part of the documentation which shows what attributes are exposed inside bpy.data https://docs.blender.org/api/current/search.html?q=bpy.data.&check_keywords=yes&area=default#
Thanks in advance.
As your running this from blender scripting possibly using bpy.context.active_object rather then bpy.context.selected_objects might work better.
There can be an active object when no objects are selected, here's more info on them: https://blender.stackexchange.com/questions/27396/whats-the-difference-among-object-active-object-and-selected-objects
It's also quite hard to tell what could be going on without more details on the internal functionings, so attaching code would be usefull.

Function arguments suggestion/autocomplete in VSCode for Python

In RStudio, function variables, parameters or arguments are displayed by pressing tab.
While VSCode has a lot of features, I cannot find a similar one for Python.
I found a way for VSCode to show me the definition of the function while hovering in the function itself, but there are no autocompletion for the actual variables of that function (nor suggestions while writing). Besides, the tooltips close itself as soon as I start typing the variables.
Is there a way to get something more similar regarding autocompletion and suggestion of function variables in VSCode while using Python?
Thanks.
According to your description, it is recommended that you use the extension "Pylance", which provides outstanding language service functions.
Its 'Docstrings' and 'auto-completion' functions show us the function parameters and will not close the prompt when inputting:
Part of its function introduction:

How can I call a python function from an advanced scripting voice command in Dragon NaturallySpeaking?

How can I call a python function from an advanced scripting voice command in Dragon NaturallySpeaking?
I don't want to use a third-party application such as dragonfly or NatLink (paper).
So, one way is to compile it. You can put a bunch of functions that do different things all into the same program and pass along appropriate arguments to select the function you want, and pass the parameters along. Returning the result can be tricky, though, but I usually use the Clipboard (so copy the py output to clip and read from clip in Dragon). Multi-word params need to have spaces escaped (%20) and process it inside your py.
Something like this:
ShellExecute "path\program.exe myFunc myPar1, my%20Par%202", 6 ' 6 runs minimized
Wait 1
myVar = Clipboard
Hth,
Warning: This is not an answer. I am not a programmer. I don't know any Python and have no way of testing it.
This is just a suggestion on how to solve this problem. I don't know where else to put this. I'd put it in a comment, but it allows no screenshots. Please edit and suggest as you wish.
There is answer on SO that deals with calling Python from Excel, which is a similar concept: https://stackoverflow.com/a/3569988/2101890. I am trying to use that here but don't know how.
When using commands in another programming language, you can sometimes add them by adding a reference in the MyCommands Editor. You can reference DLLs and other "stuff". Some references to libraries appear automatically. I've installed Python and hoped to find Python in the References, but no such luck:
There is no Python entry here that I can find. You may have better luck. If you do find something, check the box and see if you can add python commands without causing an error when saving the command.
Maybe you can browse to %localappdata%\Programs\Python\Python36\ and add some of the DLLs from there and call Python commands from there. Or try getting it to work in the way described under 1.

Viewing object attributes with tab completion in sublimerepl python

In the IDLE interpreter in Python, you can see a drop-down list of an object's attributes by typing the object's name, then period, then hitting TAB.
Is it possible to get similar functionality with sublimerepl?
I've tried the different autocomplete packages, but they don't appear to make this happen.
So there are many different packages, Andy's package being my favorite. None provide every method for a given function but try hitting "ctrl-space" after the period to see what's available!
Link:
https://sublime.wbond.net/packages/AndyPython

Is there a way to search for text in the ipython qtconsole?

I'm using ipython with qtconsole.
A feature I'm missing from the regular console is to search the console output.
I'd expect to see it under the Edit menu.
Is there a way to do it?
I don't know of that feature, but you can take advantage of the Out variable (also available as _oh) that is automatically exposed in the ipython console. Basically it's a dictionary in which the keys are the line numbers for which some kind of result was returned and the values are the results themselves. Hence, if you look for something in Out.values() using any python code you prefer should be useful to find what you're looking for.

Categories