Size: 2845
Comment:
|
Size: 3161
Comment:
|
Deletions are marked like this. | Additions are marked like this. |
Line 1: | Line 1: |
##language:zh #pragma section-numbers off ##含有章节索引导航的 ZPyUG 文章通用模板 [[TableOfContents]] ## 默许导航,请保留 [[Include(ZPyUGnav)]] = Ubuntu 中替换Python 的Tk绑定到8.5 = SEE:: * [:LeoEnvironment:Leo文学化编辑环境] * '''[:BindTk8.5ToTkinterOnUbuntu:Ubuntu 中替换Python 的Tk绑定到8.5]''' ##startInc |
|
Line 82: | Line 98: |
[[Include(QuickReplaceTk8.5,,from="^##startInc$",to="^##endInc$")]] | ##endInc |
Ubuntu 中替换Python 的Tk绑定到8.5
SEE::
[:LeoEnvironment:Leo文学化编辑环境]
[:BindTk8.5ToTkinterOnUbuntu:Ubuntu 中替换Python 的Tk绑定到8.5]
Bind Tk8.5 在Ubuntu中给Py
- 缘起
经 ZoomQuiet 的介绍接触了 [:LeoEnvironment:Leo],但由于该软件基于 Tkinter ,而 Ubuntu 上的 Tkinter
又和 Tk8.4 绑在一起,所以在 [:LeoEnvironment:Leo] 中只能使用部分字体(主要不能使用支持边缘平滑的字体) 经过在 leo-editor 讨论组中搜索,发现了一篇相关讨论提到可以通过重新编译 Python 来实现 Tkinter 和 Tk8.5 的讨论,试验了一下果然可以,现把体验记载如下,以供喜欢[:LeoEnvironment:Leo]的朋友参考
- 处置
- 1.安装 tk8.5
sudo apt-get install tk8.5 tk8.5-dev
- 2.安装完成之后,如果在idle中:
将会看到的依然是8.4
因为 ubuntu 的 Tkinter 模块和 tk8.4 进行了捆绑,必须对 python 进行重新编译才可
- 3. 编译 Python
从 Python 官方网站下载 python 源代码
依次进行:
./configure --prefix=/usr --enable-unicode=ucs4 make sudo make install
然后是
cd /usr/bin sudo rm python sudo ln -s python2.5 python
- 4.之后就可以启动 LEO, 应该立刻可以看到字体变化了,如果设置使用系统默认字体的话
还可以从菜单 Cmds -> Picklers -> Show-Fonts 的对话框中看到所有支持边缘平滑的字体了
当然如果再print Tkinter.TclVersion看到的就是8.5了
有什么疑问到 CPyUG(邮件列表 http://groups-beta.google.com/group/python-cn) 交流吧
- 反馈
- 确认!
attachment:snap-ubuntu-leo.png
遗留问题 常常有这样的问题:
Error: 4 TypeError Exception in Tk callback Function: <function masterMenuCallback at 0x90be0d4> (type: <type 'function'>) Args: () Traceback (innermost last): File "/opt/bin/leo-4.4.3a2/extensions/Pmw/Pmw_1_2/lib/PmwBase.py", line 1752, in __call__ return apply(self.func, args) File "/opt/bin/leo-4.4.3a2/src/leoMenu.py", line 1303, in masterMenuCallback return k.masterMenuHandler(stroke,command,commandName) File "/opt/bin/leo-4.4.3a2/src/leoKeys.py", line 3171, in masterMenuHandler return k.masterCommand(event,func,stroke,commandName) File "/opt/bin/leo-4.4.3a2/src/leoKeys.py", line 2262, in masterCommand c.frame.updateStatusLine() File "/opt/bin/leo-4.4.3a2/src/leoFrame.py", line 1326, in updateStatusLine self.statusLine and self.statusLine.update() File "/opt/bin/leo-4.4.3a2/src/leoTkinterFrame.py", line 738, in update s2 = s[index-col:index] TypeError: unsupported operand type(s) for -: '_tkinter.Tcl_Obj' and 'int'
- 升级!一切就好了!
attachment:zq-style-leo-snap.png
- 分享!
- attachment:080621-zq-leo-cfg.leo