Scroll python function help in Vim - python

I am learning to use vim as an IDE for Python and followed this tutorial to setup my .vimrc file. My setup is working fine.
Here, vim shows me the help for np.random.randint, but I could not figure out how to scroll through the displayed help and read about the other parameters. This feature is introduced by YouCompleMe (as far as I understand), so possible solution might be to change some configuration for it.
Since, I am new to this, I am not even sure what this feature is called (auto complete does not seem to be the right name for displaying help) and therefore was not able to find help on web-searching.
Any help will be appreciated, thanks.

YouCompleteMe uses the Jedi library for Python. If you want to install Jedi alongside YCM, this answer has some advice on how to do so.
In any case, the extra docstring information is opened in a preview window, so you should be able to switch to it in normal mode (ctrl-w w) and scroll like a regular Vim window.
If the buffer disappears when you exit insert mode, here's some sample solutions:
If you're okay with enabling mouse controls, add set mouse=a to your VIMRC, and then you can click between the buffers while typing and even scroll using your mouse wheel or trackpad.
Remove let g:ycm_autoclose_preview_window_after_completion=1 from your VIMRC, since that will remove the preview window when you enter normal mode. Then, switch to the window normally.
Change the default preview height. Just be aware that this might be annoying if you have limited screen space.

Related

Robotframework RIDE: text in Edit panel is not markable

Settings:
Windows 10. Python 2.7
different versions of RIDE: from 1.1 up to 1.5.2.1.
wxpython different versions from 2.8 up to latest.
When I double click any text in "Edit" panel and try to mark it by holding the left mouse key and moving mouse, nothing happens: the cursor does move but the color of text doesn't change.
In the 'text edit' panel everything's fine, any text can be selected/marked properly, the problem is only with the 'Edit' panel.
I have the same version of python, ride, wxpython on Windows 7 and text marking
is normal there.
Has anybody encountered such problem?
Maybe it's some kind of incompatibility with Windows 10?
I've had the same issue back when I was using RIDE. One thing you should know is, even though you don't actually see the text being selected, it is selected. In other words, if you do a CTRL+C, it will effectively copy the text you selected, you just don't visually see it being selected.
As for what causes this exactly, I'm not sure but I wouldn't bother searching too much either. RIDE really has a lot of annoying bugs like this one, and with last commit being 2 years ago, I'd say it's not maintained anymore.
You might wanna switch to raw test data editing (equivalent of text edit in RIDE) using a modern IDE like Pycharm or any other good IDE you like that offers Robot Framework test data editing, or perhaps you could try out RED, which is kind of an upgraded RIDE.

Python- Full screen nogui?

I made a program in python which allows you to type commands (e.g: if you type clock, it shows you the date and time). But, I want it to be fullscreen. The problem is that my software doesnt have gui and I dont want it to so that probably means that I wont be using tkinter or pygame. Can some of you write a whole 'hello world' program in fullscreen for me? What I am aiming for is for my program to look a bit like ms-dos. Any help??? By the way, im very new to python (approximately 4 weeks).
NOTE: I have python 3.4.1
Since Vista, cmd.exe can no longer go to full-screen mode. You'll need to implement a full-screen console emulator yourself or look for another existing solution. E.g. ConEmu appears to be able to do it.
Solution
Use your Operating System services to configure parameters.
<_aMouseRightClick_>->[Properties]->[Layout]
Kindly notice, that some of the python interpreter process window parameters are given in [char]-s, while some other in [px]:
size.Width [char]-s
size.Height[char]-s
loc.X [px]
loc.Y [px]
So adjust these values so as to please your intentions.
You may set negative values for [loc.X, loc.Y] to move/hide window edges "outside" the screen left/top edges

How to get PyCharm to check PEP8 code style?

I'm using PyCharm (v 2.7.2) to develop a Django app, but I can't get it to check PEP8 style violations.
I have enabled "PEP8 coding style violation" in the "Inspctions" section of the settings, but PyCharm doesn't highlight the style violations.
Is there a way to fix this?
Mine wasn't showing up due to the color scheme. By default it's marked as "weak warning", so you might have to edit the appearance to make it visible. Editor > Colors & Fonts > General > Errors and Warnings.
Which version of Python are you using? If it is Python 3 (maybe specifically Windows 64 bit), there are a couple of bugs logged against that on JetBrains' site:
http://youtrack.jetbrains.com/issue/PY-8923
http://youtrack.jetbrains.com/issue/PY-8077
OP asks for a way to highlight PEP8 errors on PyCharm, but there's another way (much clearer in my opinion) to see the violations (extracted from PyCharm's docs). Open Code | Inspect Code and friends:
Inspection Tool Window
View | Tool Windows | Inspection:
You can access the tool window this way only when it is already opened through Code | Inspect Code.
After you deactivate the tool window manually by clicking the Close button, the tool window is again available only through Code | Inspect Code.
The Inspection tool window displays inspection results on separate tabs
Just tested it on a PyCharm Community Edition and it worked like a charm (no pun intended).
For me I found that the best way for me was to include pep8 checking as an external script, something along the lines of this:
https://web.archive.org/web/20121206054036/http://blog.saturnlaboratories.co.za/archive/2012/09/10/running-pylint-pycharm
The advantage of doing this is that the errors appear as sort of a todo list the bottom of the frame. This way I don't have to look around the code for errors.
Well, I wish I had a better answer, but what helped me was simply the following:
switch the interpreter from a remote one to a system one
wait until the Pycharm indexing is done
switch the interpreter back to the initial/desired one

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.

highlighting a window in GNOME's window list

In order to indicate activity, some applications (e.g. Pidgin) highlight their entry in GNOME's Window List panel widget (e.g. via bold font or flashing color). This indication is reset automatically when the window is activated.
I have a terminal application for which I would like to achieve the same thing (preferably via Perl, but Python would work too) - but I have no idea where to start. I imagine I'd first have to find the terminal window (based on window title) and then trigger some kind of GTK action.
Any help would be greatly appreciated!
In a GTK application, use gtk_window_set_urgency_hint(). If you have a terminal application, you can't really do that - with libwnck you can get information about other application's windows, but as far as I know you can't get a GtkWindow pointer to another application's window.
May I suggest using the terminal beep? Of course this isn't a sure way to attract the user's attention, but some terminals are able to flash the title bar instead of beeping, or such things.
I'm not really into GTK programming, but as far as i know you want to set an "URGENT"-Flag for the Window which should be highlighted. Maybe this will get you any further. :)

Categories

Resources