###### tags: `Python`
# ptpython
[ptpython](https://github.com/prompt-toolkit/ptpython) 的[範例設定檔 config.py](https://github.com/jonathanslenders/ptpython/blob/master/examples/ptpython_config/config.py)。
## 設定檔儲存位置
- Windows
~/AppData/Local/prompt_toolkit/ptpython
- Linux
~/.config/ptpython
- Mac
~/Library/Application Support/ptpython/config.py
## 預設的配色
預設提供的配色可參考[這裡](https://pygments.org/styles/)。也可以看[這裡](https://pygments.org/demo/)動態展示效果。
## 設定檔內容
```python
"""
Configuration example for ``ptpython``.
Copy this file to $XDG_CONFIG_HOME/ptpython/config.py
On Linux, this is: ~/.config/ptpython/config.py
"""
from prompt_toolkit.filters import ViInsertMode
from prompt_toolkit.key_binding.key_processor import KeyPress
from prompt_toolkit.keys import Keys
from prompt_toolkit.styles import Style
from ptpython.layout import CompletionVisualisation
__all__ = ["configure"]
def configure(repl):
"""
Configuration method. This is called during the start-up of ptpython.
:param repl: `PythonRepl` instance.
"""
# Use this colorscheme for the code.
# Ptpython uses Pygments for code styling, so you can choose from Pygments'
# color schemes. See:
# https://pygments.org/docs/styles/
# https://pygments.org/demo/
# repl.use_code_colorscheme("default")
# A colorscheme that looks good on dark backgrounds is 'native':
repl.use_code_colorscheme("monokai")
```