使用 gedit 里的 python console 如何访问编辑窗口的内容?

OOo,TeX,KO,ABI,GIMP,Picasa,ProE,QCAD,Inkscape,Kicad,Eagle
回复
saintthor
帖子: 107
注册时间: 2014-05-30 15:45
系统: 14.04

使用 gedit 里的 python console 如何访问编辑窗口的内容?

#1

帖子 saintthor » 2015-11-29 16:05

我想做这样一件事:把一篇文章粘贴到 gedit 里,将其中所有半角标点符号替换为全角。用 replace 要做很多遍。

正好看到 gedit 有个 python console,我希望写个脚本来执行这些替换。

问题是,我在 python console 里怎么访问编辑窗口里的文字?
头像
vickycq
帖子: 4507
注册时间: 2011-03-20 13:12
系统: Debian
来自: 山东省寿光县
联系:

Re: 使用 gedit 里的 python console 如何访问编辑窗口的内容?

#2

帖子 vickycq » 2015-11-29 17:54

gedit python console 使用参考
https://wiki.gnome.org/Apps/Gedit/PythonPluginHowTo

不过看起来主要作用是控制 gedit 本身,而不是其中的文档
如果想在 gedit 里用脚本操作文档,可用 external tools 插件运行脚本
Debian 中文论坛 - forums.debiancn.org
欢迎所有 Debian GNU/Linux 用户
回复