Spyder - hints disappear too fast - python

So I'm using Spyder as my Python IDE. It has a great feature which are hints, f.e when I type numpy.arange( it shows me, that I need to insert stop, start, step etc. But it appears on screen, and disappears after like 2-3s, and most of the times I don't manage to read the whole thing, but anyways I would still like to see it, just to think about what should I type. So is there a way to extend the timeout of those hints, or make them stay there until f.e I close the parentheses?
P.S Am I having delusions, or is IPython interpreter much faster than simple Python command line interpreter?
P.S2 Is there a way, to make Spyder do auto-indentation (f.e after going to a new line inside of a function?)

FryninoS,
If you put your mouse over the information box it will stay open until you move the mouse off the box.
Austin.

Related

vs code remove white box in editor interface

Basically when I open a file on VScode, a new one or one that I already have, it splits the editor into two, but one half is blank, almost like it was a preview because as I scroll down the code, it follows, but empty....
This "preview blank space" occupies half the screen and it's really bothering me... Could you please help? I think it's a command i have to execute because I've tried to reset the settings and even uninstall the VS code and it stays the same.
It doesn't have any close options (nor the right or left button of the mouse) and I can't move it anywhere (nor open a file on it). Also, I don't think it's editor split because I already did and undo that and it doesn't solve
If anyone knows how to fix it, I would really appreciate because I can't find a solution anywhere and I'm desperate..

What does it mean to "restart" a program (in my case IDLE)?

This answer on Stack Overflow offers a solution I am trying to implement. In particular, see the sections "Installation Instructions" and "How to Use".
Can anyone tell me the steps required to "restart" IDLE?
New Information:
Just as people have suggested I thought this simply meant closing the program and opening it back up again...but I already tried that.
The other twist to my situation is that I'm working on a virtual machine so I was unable to do the installation of IDLE2HTML.py myself. My work's Help Desk had to do it so I cannot speak for the accuracy of their work. For now I'm assuming they did it correctly, but when I go to the "Options" menu there is no option to "Save as HTML".
My only guess at this point is that I still need to "restart IDLE".
Just wanted to double check if there was something else I could do before going back to my Help Desk department.
IDLE reads the idlelib/config-xyz.def files, including config-extensions.def, just once, when it starts. So any changes to config-extensions.def only takes effect the next time you start IDLE.
If you do not see 'Save as HTML' after starting IDLE, the extension is not installed properly.
It means you need to close the IDLE so that any changes made by the script can affect the IDLE
Simply close the IDLE either via the X, Ctrl+Q or File>Exit, then open the IDLE again.
If you are using idlelib module from a Python program then close your program and run it again.

breaking out of python shell prompt "...:" in enthought canopy

Context: using Enthought's Canopy Version: 1.7.4.3348 (64 bit) on Windows 10.
Typing into the python shell, errors produce a "...:" prompt, which I can then not break out of. Hitting enter and trying other ideas sadly leads to a repeat of the same prompt. How to break out of this mode, and get on with debugging?
EDITED, see bottom of answer
The key point to understand is that when IPython prompts you with ..., it is because you are in the middle of typing a multi-line statement (whether that was your intention or not). Typically this is because on some previous line, you typed a left parenthesis (or bracket), or a triple-quote-mark, etc and IPython is waiting for you to complete your statement with a right parenthesis or matching triple-quote, etc.
So what you probably want to do is simply to erase your partially entered statement. The easiest way to do this, assuming that your cursor is already at the end of the last line in your multi-line statement, is just to press and hold the backspace key until your statement is all erased. Slightly quicker is to do the same with Ctrl+Backspace, which erases a word at a time instead of a character at a time. After you've erased all the garbage, press Enter, not actually needed but it will make you feel better, to convince yourself that everything is back to normal.
(BTW, the fact that you were actually in the middle of typing a single long statement also explains why typing "quit" does nothing; you are not really typing a "quit" command, but just typing the additional letters "quit" into the middle of your already too-long and erroneous command, whatever that might be, which makes it even longer and more erroneous!
As a further side note -- quit is actually not very useful in Canopy's IPython panel, because it just closes the panel but doesn't really close down IPython; if you reopen the panel from the View menu, it is still just as you left it. If you really want to restart IPython (clear all your variables and imports), do it with the "Restart kernel" command in Canopy's Run menu.)
EDIT:
OP's screen shots, sent privately, showed that Autodebug mode was on (this is the bulls-eye-like icon on the toolbar.) The solution was to toggle off Autodebug.
Background: Autodebug hooks into the channel between Canopy's IPython (QtConsole) front end, and the IPython kernel back end. If autodebug is left on, some problems can break this channel. This should be improved in Canopy 2.0, currently in alpha internally.
Try pressing Ctrl + D, that help in coming out of the console panel.

Spyder missing Object Inspector

I just installed Anaconda and running Spyder I cannot find the Object Inspector. Hitting Ctrl+I has no effect and in the View/Panes menu there is no item Object Inspector.
I have seen videos and tutorials that show the Object Inspector. What is happening?
The "Object Inspector" is now called "Help" (from Spyder version 3.0 onwards); see https://groups.google.com/forum/#!topic/spyderlib/pF7KmSKDFXc . However, the Ctrl-I shortcut has not been changed, so I'm not sure what's happening with that.
go to preferences > Help and enable the Automatic connections for Editor and restart the Spyder
This worked for me!!
Although it's given in the tutorials but I'll explain.
1) Object Inspector is now known as Help.
2) I'm using Spyder 3.6, here go to Tools-->Preferences-->Help-->Check on Editor in Automatic Connections
3) Select your parameter and Ctrl+I
That'll do it.
I had the same problem. I found the help and then discovered that I got a message saying No Documentation. I tried changing the setting from Rich Text to Plain Text and for some reason that worked and I'm able to use the Object Inspector.
Since they changed "Object Inspector" to "Help", as Jitse Niesen says, they might have changed the shortcut too. In my Mac version the shortcut for "Help" is Shift+Cmd+H so the combination you are looking for is probably Ctrl+H.
On mac using Spyder 3.3.1 run from Anaconda.
Cmd + I was not working for me at first to show the object inspector on the right pane for help on a particular function. So I typed in Cmd + , (which is to access preferences panel in any app on Mac), and went down to "Help" on the left side.
Then, I checked the boxes for "Editor" and "IPython Console" under the description that says
"This pane can automatically show an object's help information after a left parenthesis is written next to it. Below you can decide to which plugin you want to connect it to turn on this feature."
After checking these boxes and pressing OK, Cmd + I still did not work for getting the object information.
I restarted Spyder, closing it and reopening it from Anaconda navigator.
Now Cmd + I works and shows the information for whatever function I click on.
Hope this helps someone. I'm still not quite sure what happened here (since those checkboxes were for the left parenthesis function), but I still thought that sharing the steps will be useful to some people.
In Windows, Ctrl+Shift+H worked after making changes to preferences as suggested by Ibrahem
Go to preferences->Help and tick the option of showing object info on Editor , then ctrl+I will work with any object
One way to go about this is to go to View > Panes > Online Help. Then in the search box insert the module or package like so (sklearn.preprocessing.Imputer) and you will have all the docs related to the package.(**Shortest way: click on package....then Cmd + i )
Alternatively, right clicking the Object in the editor, select Go to Definition
Third way, in your console, type help(your class here) like help(Imputer) or just help() to get the interactive console then type your package there (sklearn.preprocessing.Imputer`).
Hope this help someone.
After pressing Ctrl+H , a help window will come in that in [Source] dropdown select Console
Please check the spelling of your command, if you type wrong spelling it wont display the help
Note that in Spyder version 3.2.4 under Tools>Preferences>Help>Automatic Connections it clearly now states: "This pane can automatically show an object's help information after a left parenthesis is written next to it. Below you can decide to which plugin you want to connect it to turn on this feature." Then you can select Editor and/or IPython Console.
When I tried this, placing a left parenthesis before the (term is the only way I could get the help to bring up an example and a definition.
Nothing worked from above. I can debug objects easy in Visual Studio Code, but I can not do it in Spyder 3.2.8 installed with Anaconda 5.2 for Windows. In IPython console during debugging I use following.
To inspect an object:
vars(my_object)
To list class objects:
[obj.name for obj in gc.get_objects() if isinstance(obj, my_class)]
This solution solved the problem and shows objects in Variable Explorer.
https://gitter.im/spyder-ide/public?at=5b69bac8e9ab53770ca018d0
Question:
How can I explore objects during debugging like I explore variables?
In IPython consle I use vars(my_object), this is a prompt way. I want a GUI way for Object like Variable explorer.
I want a GUI way for Object like Variable explorer.
Answer:
As a matter of fact, Spyder has one, exactly like the Variable Explorer: it's called...the Variable Explorer! If you can't see them, make sure Exclude unsupported data types is not selected under the "Gear" menu in the top right of the pane.
Most arbitrary objects should work, although there may occasionally be a few bugs for more esoteric ones. Even better support will be coming in Spyder 4.
Just left click on the top right corner, beside the close tab of editor and below the working directory tab
I tried it, and it successfully worked.

Windows Balloon-tooltips in Python

Following the example at http://article.gmane.org/gmane.comp.python.general/541418, I've succeeded in creating a callable class for balloon tooltips, but the greater complexities of that code elude me when it comes to customization. I browsed a bit of how it works through msdn, but being a novice at more windows-esque languagues like c and vb, etc. I was unable to make much sense of it.
So I ask ye snakely academics:
Things I'd like to be able to do with that code aside from the standard icon, title, text:
Perform actions based on clicking the tooltip
Modify the tooltip that pops up over the icon in the system tray after loading it (to reflect changing values)
Multiple lines? (Not sure if this can even be done, really)
More information on other things you could do in a windows 7 environment versus XP (which seems to be what this was written for).
Ideally I'd get some sort of return value or some semblance of an event when the tooltip is clicked so that I could run some code, but currently I'm importing that code as a module and calling at various times, so I'm not sure how to handle clicks outside of the popup code itself...
Information on handling these things with python seems quite scarce. Thanks in advance.
Perform actions based on clicking the tooltip
Whats the problem OnTaskbarNotify? Hock yourself in there.
Modify the tooltip that pops up over the icon in the system tray after loading it (to reflect changing values)
Probably not, I am not sure about the WinAPI here. I haven't seen it in the wild, so...
Multiple lines? (Not sure if this can even be done, really)
With most WinAPI, just insert a \n in the string.
More information on other things you could do in a windows 7 environment versus XP (which seems to be what this was written for).
LOTS... But that is a bit vague... It depends what your needs are. But for kol feturez you need to google on your own...
On Linux and Unix systems I use the notify-send OS already implemented system.
import os
os.system('notify-send "'+title+'" "'+message+'")
Maybe in Windows there is some API32 for this.
Check this https://gist.github.com/wontoncc/1808234

Categories