Python Forum

Full Version: how include a python code in notpad++ plugin
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
hi
I wanted to draw a line in notpad++, so I searched Google for it.
in address: https://sourceforge.net/p/notepad-plus/d.../a0308d54/
has been written that
Quote:Or you could install the python script plug-in and use this bit of python
:
and said that the below code must be used:
#####
## Draw a dashed line
#####

# First we'll start an undo action, then Ctrl-Z will undo the actions of the whole script
editor.beginUndoAction()

dash='-'
width=80
print dash*width

## Finished.
# End the undo action, so Ctrl-Z will undo the above two actions
editor.endUndoAction()

# Turn the undo recorder back on.
editor.setUndoCollection(1)
I have Python script in notepad++ on my PC(it is in the plugin tab in the notepad++). how can I use the above code in notpad++?
thanks
It's simpler to just use the Macro
Macro > Start Recording make a line 80 dash line Macro > Stop Recording
Macro > Save current recorded macro as eg line_80 then is finish,can use from Macro meny or assign a key to it.
You need to install the python plugin, then you create a shortcut.

https://www.delftstack.com/howto/python/...un-python/

I think the python plugin is meant more as a python development tool (like an IDE) than as a way to write notepad++ plugins.