message that pops up while writing python code on vscode - python

I am not sure what it is actually called. I am a beginner. I am learning python and using VS Code as my code editor. But when I write codes the message in the red circle highlighted in the screenshot pops up. It's kind of annoying.
Can someone please help me with it? I don't know what it is called and would like to turn it off.

That pop up just shows the structure of the function you are using. It includes parameter hints.
In the image it is showing the structure of print function. It's a useful feature to be honest.
Press esc to cancel out of an individual popup, or set"editor.parameterHints.enabled": false to disable it entirely.

So, that box you have there is the documentation of the method you are calling. In this case, print(). It's actually quite useful. It'll give you a quick description of the parameters that you can pass into the function. For more confusing functions, the auto-documentation is a must have. But, of course, it is up to you.
You can disable it by setting "editor.parameterHints.enabled" to false in your .json

This is a function provided by VS Code to display information such as method parameters. You can turn it off in settings.
Click the gear icon in the lower left corner and select Settings,
then search for parameterhints, and uncheck the options in the picture.
In addition, as mentioned above, you can also add the following configuration to the settings.json file to achieve the same effect.
"editor.parameterHints.enabled": false

Related

How can I start an interactive session at breakpoint in VS Code?

Above is a typical situation that I encounter. We hit an exception and now would like to get some more details about what went wrong. This is where I wish I could just jump right into an interactive python session and try to run the marked line manually to find out e.g. what the find_many might look like and if it actually does have a select method. How can I do this?
I think the Debug Console is what you are looking for. Press F1 and type debug console if you do not find the window.
You can use shift+enter or manual select the option like the following picture with the right mouse button.

prettier seems to not working in VScode (python)

I don't actually know how these thins work, apparently prettier explains how to make it the main formatter on their page:
{
"editor.defaultFormatter": "esbenp.prettier-vscode",
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
}
but i dont even know how to set this things.
anyways, my question is, after i complete my writing, when i type ctrl + s (save) on my vscode, it used to make it, well, prettier. but now it doesnt change anything (and it is not pretty at all).
now, at the bottom right of the screen, i see this:
what i see on my bottom right corner for prettier
and if i click that, ahem, empty set (?) image next to prettier, it becomes a double tick, but it exist my coding area and enter the output section:
after i click on the thing
and if i click back to my coding area, it again becomes an, well, empty set (?) symbol.
all the help is appraciated.
ps: this is my first question, please go easy on my
sincerly
It's probably missing something in your settings. VSCode allows you to edit your settings through GUI or text (using JSON syntax).
Go to your settings using the GUI and type: "Format", then make sure you have enabled the option "Editor: Format On Save".
Depending your formatter settings, when you save a file it should work as you expected.

Drop frame while debugging?

I'd like to know if drop frame is available in PyCharm / Intellij with Python plugin.
Here's what the button looks like (it doesn't show up on the debug toolbar so I assume it's just not available for PyCharm) -->
How to step one step back in IntelliJ?
What I'm trying to do is to re-play a function when I see a problem, to inspect it more. ("come back in time")
(I've used this before in Eclipse with Java, it would replay the current scope if you edited it and saved changes. of course the global scope remains changed after running a function many times, but for most cases it's very useful)
Thanks for telling!
As of version 2017.3.3, there is no drop frame feature as that in IntelliJ. The pycharm docs referred above seems wrong.
Since you want to 're-ply a function', 'Evaluate Expression' works great for that purpose. I use a lot when I debug. It basically allows to run any code at runtime with the variables and functions in that context.
It is the icon on the most right on the debug window.
Put a break point on the line before the line where goes wrong, debug the program, when it tops on the break point, click on 'Evaluate Expression' icon, copy the function with issues, paste it and run it.
PyCharm 2017.2 seems to have added the functionality you're looking for. The documentation describes a "Drop frame button" on the Debug Stepping Toolbar:
Interrupts execution and returns to the initial point of method execution. In the process, it drops the current method frames from the stack.

wxPython: control navigation within wx.Lisbook wx.Panels

world!
I'd like to ask you one question, a simple solution (I guess) for a nerve-wracking problem I'm encountering using a wx.Lisbook component of wxPython.
In fact, I want to switch from a wx.Panel to another fluently, withou requiring a user input. I've already tried the SetFocus(), Show()/ShowWithEffect() + Hide()/HideWithEffect() methods, without great results.
Show()/Hide() gives the better results, but the selected Thumbnail remains the previous displayed panel...
Any idea of the method or good practice to manipulate wx.Listbook?
Thanks very much by advance for your answers!
Patrice
You want to be able to switch between panels? You should check out the various "Book" controls in wxPython, such as the Toolbook, Notebook, AUINotebook, etc. I also wrote a tutorial that's just on switching panels using the menu:
http://www.blog.pythonlibrary.org/2010/06/16/wxpython-how-to-switch-between-panels/
You could use a wx.Timer to do the switching too if you didn't want any user involvement.

Python IDLE. Auto-complete/Show completions not working

IDLE is being very dodgy as to when it will actually show an Auto-complete menu. As of late it hasn't been working at all, or, more specifically, only works during an interactive session.
I've been using Code Blocks for C, and have gotten really used to the very nice auto-complete features, so it's a bit frustrating not having them -- especially while trying to learn a new frame work and what class is associated with which methods, etc, etc..
Is there an easy fix to get IDLE auto-complete working again? I'm using python version 2.7.
Is there perhaps a simple editor I should look into? I've tried Vim, which was a little too heavy for my simple needs, Ninja, which I couldn't get to work for anything, and Sublime text 2, which I couldn't get my wxpython stuff to play with. What would a nice option be? Anything similar to Code Blocks would be cool, although, I'd be perfectly happy with IDLE if it would consistently work!
REQUESTED CLARIFICATION:
OK, so it seems I may have some of my terminology backwards. By non-interactive, I mean, for instance, right clicking on a python file and selecting "edit with IDLE". This brings up what I guess could be described as a text editor. You can enter all you code here. Once ready, you then hit F5, or select Run, and it launches (what I've been referring to as) the interactive terminal. It's here that you can type in code, press return, and instantly have that code evaluated.
What my question is referring to it the former, the part of IDLE where you edit the code. Sometimes while typing, after a . it will display the available methods, or after an open parenthesis it'll give hints as to the values expected. but the thing is, sometimes it does these things, sometimes it doesn't.
The only thing i found so far is that if an editing session of IDLE is connected with python shell (called "interactive mode" in the question, i.e. after an attempt to run the edited script) then "non-interactive" IDLE can autocomplete based on values in interactive window. For example, if I type
a = [];
a.appen
and then hit < Tab > it will do nothing, but if I previously type
a = []
in corresponding python shell, IDLE will autocomplete correctly.
So my only suggestion is import same modules with same names in python shell window in order to make them "visible" for non-interactive IDLE editor.
I had the same problem with IDLE, because I want to learn Qt and therefore autocompletion is very useful.
As it says in the settings of IDLE, you can trigger the autocomplete with "Control + Space", e.g. after a "QtGui.". Then a menu opens where you can arrow-scroll through the entries.
using the 'IDLE Editor window', you need to save and execute your code first.
The application running, turn back to the Editor window to use the auto-completion.
In my case, I had to open Options menu -> Extensions tab on the editor and look to make sure AutoComplete and other relevant options were enabled. They actually were, but by just clicking on 'Apply' even though I dint have to change anything did the trick for me.
Sometimes it has to do with the time you have to wait to get a suggestions.
When you go to options > extensions > general at completions popup wait you can change it to about 500ms.
In my case it was 2000ms by default.

Categories

Resources