Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revisionLast revisionBoth sides next revision | ||
appwiki:notepadplusplus [2023/02/02 06:56] – [Integrate Your Python Script with Notepad++] ying | appwiki:notepadplusplus [2023/02/06 06:07] – [Integrate Your Python Script with Notepad++] ying | ||
---|---|---|---|
Line 90: | Line 90: | ||
* install: | * install: | ||
- | * from plugin manager | + | |
- | * or download manually and put in plugin folder from http:// | + | |
+ | * for tkinter lib, go lastest release version: https:// | ||
+ | * unzip PythonScript_TclTk_xxx.xxx.zip, | ||
+ | * (optional) unzip PythonScript_ExtraLibs_xxxx.zip if you need lib2to3, distutils, | ||
+ | * (outdate) <del>or download manually and put in plugin folder from http:// | ||
+ | </ | ||
* Python for Npp document | * Python for Npp document | ||
* http:// | * http:// | ||
Line 250: | Line 254: | ||
* the default loading directory for NppPythonScript plugin, any script will be automatically add to path for import < | * the default loading directory for NppPythonScript plugin, any script will be automatically add to path for import < | ||
npp\plugins\PythonScript\lib | npp\plugins\PythonScript\lib | ||
- | npp\plugins\PythonScript\scripts | + | npp\plugins\PythonScript\scripts |
npp\plugins\Config\PythonScript\lib | npp\plugins\Config\PythonScript\lib | ||
npp\plugins\Config\PythonScript\scripts | npp\plugins\Config\PythonScript\scripts | ||
Line 329: | Line 333: | ||
* use notepad as interactive python runner: https:// | * use notepad as interactive python runner: https:// | ||
+ | ==== Qt GUI and PythonScript ==== | ||
+ | |||
+ | * To get Qt (PySide or PyQt4) to work with PythonScript, | ||
+ | * if you use Plugins > PythonScript > Show Console, it will show the python 2.7.18 in 64bit (my case) as the python version | ||
+ | * download the same or similar version of Python from python offical website, | ||
+ | * search version number in https:// | ||
+ | * (my case) https:// | ||
+ | * download " | ||
+ | * in install step, you can choose where to install, and where add python.exe to path, by default it won't, as if you already have multiple python versions installed, choose not add to path will not affect your current setup, choose add to path, if you want it to be your default python as well. (my case, I just want it to be a py2.7 package download, so I don't check add python.exe to path during install) | ||
+ | * once ok, you can use your own python to install package, and add the site-packages path to PythonScript python' | ||
+ | * start your standalone python, and run (PySide, | ||
+ | import subprocess | ||
+ | import sys | ||
+ | def install(package): | ||
+ | subprocess.check_call([sys.executable, | ||
+ | # py2 case: 2.7 = PySide | ||
+ | install(" | ||
+ | |||
+ | # py3 case: 3.x = PySide2 | ||
+ | install(" | ||
+ | </ | ||
+ | * add that standalone package path to PythonScript config startup.py file < | ||
+ | # notepad path\plugins\Config\PythonScript\scripts\startup.py | ||
+ | </ | ||
+ | # optional clear multiple python registered system path issue | ||
+ | old_path = sys.path | ||
+ | old_path = [x for x in old_path if not x.startswith(' | ||
+ | sys.path = old_path | ||
+ | |||
+ | # register lib path | ||
+ | import os | ||
+ | my_path_list =[ | ||
+ | r' | ||
+ | r' | ||
+ | r' | ||
+ | ] | ||
+ | for x in my_path_list: | ||
+ | if os.path.isdir(x): | ||
+ | sys.path.append(x) | ||
+ | |||
+ | </ | ||
==== My Npp Python Script ==== | ==== My Npp Python Script ==== | ||