Differences between revisions 8 and 9
Revision 8 as of 2008-10-30 14:49:54
Size: 3161
Editor: ZoomQuiet
Comment:
Revision 9 as of 2009-12-25 07:11:02
Size: 3178
Editor: localhost
Comment: converted to 1.6 markup
Deletions are marked like this. Additions are marked like this.
Line 4: Line 4:
[[TableOfContents]] <<TableOfContents>>
Line 6: Line 6:
[[Include(ZPyUGnav)]] <<Include(ZPyUGnav)>>
Line 12: Line 12:
 * [:LeoEnvironment:Leo文学化编辑环境]
  * '''[:BindTk8.5ToTkinterOnUbuntu:Ubuntu 中替换Python 的Tk绑定到8.5]'''
 * [[LeoEnvironment|Leo文学化编辑环境]]
  * '''[[BindTk8.5ToTkinterOnUbuntu|Ubuntu 中替换Python 的Tk绑定到8.5]]'''
Line 19: Line 19:
  * 经 ZoomQuiet 的介绍接触了 [:LeoEnvironment:Leo],但由于该软件基于 Tkinter ,而 Ubuntu 上的 Tkinter
又和 Tk8.4 绑在一起,所以在 [:LeoEnvironment:Leo] 中只能使用部分字体(主要不能使用支持边缘平滑的字体)
  * 经 ZoomQuiet 的介绍接触了 [[LeoEnvironment|Leo]],但由于该软件基于 Tkinter ,而 Ubuntu 上的 Tkinter
又和 Tk8.4 绑在一起,所以在 [[LeoEnvironment|Leo]] 中只能使用部分字体(主要不能使用支持边缘平滑的字体)
Line 22: Line 22:
Tkinter 和 Tk8.5 的讨论,试验了一下果然可以,现把体验记载如下,以供喜欢[:LeoEnvironment:Leo]的朋友参考 Tkinter 和 Tk8.5 的讨论,试验了一下果然可以,现把体验记载如下,以供喜欢[[LeoEnvironment|Leo]]的朋友参考
Line 71: Line 71:
attachment:snap-ubuntu-leo.png {{attachment:snap-ubuntu-leo.png}}
Line 93: Line 93:
attachment:zq-style-leo-snap.png {{attachment:zq-style-leo-snap.png}}
Line 96: Line 96:
  * attachment:080621-zq-leo-cfg.leo   * [[attachment:080621-zq-leo-cfg.leo]]

Ubuntu 中替换Python 的Tk绑定到8.5

SEE::

Bind Tk8.5 在Ubuntu中给Py

缘起
  • ZoomQuiet 的介绍接触了 Leo,但由于该软件基于 Tkinter ,而 Ubuntu 上的 Tkinter

又和 Tk8.4 绑在一起,所以在 Leo 中只能使用部分字体(主要不能使用支持边缘平滑的字体) 经过在 leo-editor 讨论组中搜索,发现了一篇相关讨论提到可以通过重新编译 Python 来实现 Tkinter 和 Tk8.5 的讨论,试验了一下果然可以,现把体验记载如下,以供喜欢Leo的朋友参考

处置
  • 1.安装 tk8.5

sudo apt-get install tk8.5 tk8.5-dev
  • 2.安装完成之后,如果在idle中:

   1 import Tkinter
   2 print Tkinter.TclVersion

将会看到的依然是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) 交流吧

反馈
  • 确认!

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'
  • 升级!一切就好了!

zq-style-leo-snap.png

分享!

BindTk8.5ToTkinterOnUbuntu (last edited 2009-12-25 07:11:02 by localhost)