Is there any way to enable code hiding (hides the details of a class or a function just shows the definition) and line numbers in IDLE ?
Don't think so. It was discussed briefly on the mailing lists, but I don't believe anything's come out of it since.
If you're interested in code folding, look into slightly more powerful editors - Geany (GTK) and Sublime Text both support code folding.
A code/line folding feature was asked before in that Python Issue. It was closed and rejected but with good reasons.
If you know this features of IDLE you maybe do not need code folding anymore.
Module Browser:
To get an outline view of a file's classes and functions, use File => Module Browser (ALT+C).
Code Context:
To get a dynamic view of nested compound statement headers with Options => Code Context.
Related
Not long ago, I started commenting a lot of code in python, the problem is that vs code does not offer me to reduce the comment.
I have tried single line comments and group comments but same issue..
python single line comment
python multiline program
In other languages for example C.. it offers me in the bar a button to collapse
example in C
How can comment collapsing be enabled in VS?
I tried it. I think vscode itself provides this function, but I don't know why it doesn't work for you.
As can be seen from the figure, multiline annotations can be folded.
Of course, there is no solution for your situation. We can add #region before the content, add #endregion after it.
I am using PyDev for Python programming in Eclipse.
Is it possible to make PyDev auto-format my code to limit the maximum number of characters on a single line?
With standard PyDev
It seems that this option is only available in Eclipse's Java Editor.
The Java editor allows you to create "profiles" for the code formatter, while PyDev's options for the code formatter are very limited.
However,
You can hack this. PythonTidy.py is an awesome script that cleans up Python code to make it follow PEP8 conventions, and that can be tweaked with your own settings.
PythonTidy (code cleanup & formatting)
Get here (homepage) the source for PythonTidy.
You will see inside the file, at the beginning of the code and just after the comments, that many settings are defined.
The first one of these is COL_LIMIT with its default value set to 72. Now you can use PythonTidy to format your code the way you want.
Integration with PyDev
Now you have to make this work with PyDev's formatting. This blog post will explain it really better than me, but still I'll sum up the steps :
Write a Jython interface betwenn PyDev's editor (PyEdit) and PythonTidy. This blog's author already wrote a wrapper script in the public domain available in the above link or here in case the link goes 404.
Save this file anywhere you want, with the name pyedit_pythontidy.py, along with the PythonTidy.py file.
Configure PyDev to use this script as its Code Formatter. You can do this in Preferences > PyDev > Scripting PyDev
Note #1: I really recommend reading the original blog post to have a better understanding
Note #2: The wrapper script author did not implement Code Block formatting, so this means you can only format a full file. This should not be that hard to implement, up to you.
Note #3: All credits goes to bear330 for the PyDev integration part.
I want to write a little IDE for Cython using PyQT, but I don't have any idea how to implement Syntax Highlighting.
I know how to parse the Python-source, but I don't know how I can set the color for different words within the Textfield in PyQT.
I could use HTML for this, but how does it work in realtime ? I mean when the user edits the text I need to be able to immediately change the text's format, etc.
Do you know how I can achieve this ?
Have you considered using QScintilla?
"As well as features found in standard text editing components, QScintilla includes features especially useful when editing and debugging source code. These include support for syntax styling, error indicators, code completion and call tips."
I would recommend checking out the code in KhtEditor which is written in Python using PyQt. I believe the author is also working on a port from QWidget to QML.
I've gotten omnicompletion with Pysmell to work before, but I can't seem to do it again.
I tried following some steps online, but most, if not all, of them are to vague and assume too much that you know what you are doing to some extent.
Can someone post a full, step-by-step tutorial on how to get code completion working properly, for complete Vim newbies (for dummies?)?
There's also Ctrl+n in insert mode which will autocomplete based on the words it has seen in any of the open buffers (even in other tabs).
You may try Pydiction (Excerpt below)
Description Pydiction allows you to
Tab-complete Python code in Vim,
including: standard, custom and
third-party modules and packages. Plus
keywords, built-ins, and string
literals.
Pyflakes has a vim plugin that does this pretty awesomely. Unlike Pydiction, you don't need to build a dictionary beforehand (so if you're bouncing between different virtualenvs it's a bit less hassle.) I haven't been using it long but it seems very slick.
Try hitting Ctrl-p while typing mid-word. Ctrl-p inserts the most recent word that starts with the prefix you're typing and Ctrl-n inserts the next match. If you have several possibilities, you can hit ctrl-p more than once to substitute each candidate in order.
In visual studio, I could just press ctrl+spacekey and the methods appeared. In Geany is there a way for me to get this functionality?
No, because is Python is dynamically typed language and quite hard to achieve that. Python plugins for netbeans do that partially, but I believe such plugin is not in geany developers plans. There are different things to be done ;-)
However, geany provides some completions support. First, it analyzes your imports in a file and uses it in completions; furthermore it completes functions from the std library. It also analyzes all you open files for suggestions, although you may need to apply it in preferences. Also you can get call tips, when you hit Ctrl+Shift+Space, which not everyone know about. They are quite good, because they appear in form <Class>.<method>(<args>), which is very helpful.
shortcut ctrl+space works for me. also, you can setup autocomplete suggestion length (ie how many letters you must type before the autocomplete tooltip pops up automatically - http://www.geany.org/manual/current/#editor-completions-preferences ).
this works only for method names. if i want to see the options for method parameters, i must type bracket ( after the method full name.