Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

只添加调试信息, 查看图片路径 #3

Closed
wants to merge 23 commits into from
Closed

只添加调试信息, 查看图片路径 #3

wants to merge 23 commits into from

Conversation

nobodxbodon
Copy link
Collaborator

@CNMan
Copy link
Owner

CNMan commented Sep 26, 2018

screenshot from 2018-09-27 02-41-34

提示找不到图片

[cnman@localhost ~]$ cd UnicodeCJK-WuBi-master/
[cnman@localhost UnicodeCJK-WuBi-master]$ ls -l      
total 2444
-rwxrwxrwx  1 cnman cnman  157047 Sep 26 13:39 CJK-A.txt
-rwxrwxrwx  1 cnman cnman 1105820 Sep 26 13:40 CJK-B.txt
-rwxrwxrwx  1 cnman cnman  107389 Sep 26 13:41 CJK-C.txt
-rwxrwxrwx  1 cnman cnman    5754 Sep 26 13:42 CJK-D.txt
-rwxrwxrwx  1 cnman cnman  149284 Sep 26 13:43 CJK-E.txt
-rwxrwxrwx  1 cnman cnman  163581 Sep 26 13:45 CJK-F.txt
-rwxrwxrwx  1 cnman cnman  783786 Sep 26 14:31 CJK.txt
drwxrwxrwx 11 cnman cnman     157 Sep 26 15:08 FontGlyphs
-rwxrwxrwx  1 cnman cnman     778 Sep 26 14:39 README.md
-rwxrwxrwx  1 cnman cnman    9753 Sep 27 02:39 wubicodeeditor.py
[cnman@localhost UnicodeCJK-WuBi-master]$ ls -l FontGlyphs/FZKaiT/Plane00/U_003400.png
-rwxrwxrwx 1 cnman cnman 717 Sep 25 08:01 FontGlyphs/FZKaiT/Plane00/U_003400.png
[cnman@localhost UnicodeCJK-WuBi-master]$ cd FontGlyphs/
[cnman@localhost FontGlyphs]$ ls -l      
total 0
drwxrwxrwx 4 cnman cnman 36 Sep 25 08:46 FZKaiS
drwxrwxrwx 4 cnman cnman 36 Sep 25 08:49 FZKaiT
drwxrwxrwx 4 cnman cnman 36 Sep 19 17:59 HanaMin
drwxrwxrwx 4 cnman cnman 36 Sep 24 02:24 HYFangSong
drwxrwxrwx 4 cnman cnman 36 Sep 24 04:30 HYZiDianSong
drwxrwxrwx 4 cnman cnman 36 Sep 19 11:04 MingLiU
drwxrwxrwx 4 cnman cnman 36 Sep 19 11:04 MingLiU_HKSCS
drwxrwxrwx 4 cnman cnman 36 Sep 18 17:26 SimSun
drwxrwxrwx 4 cnman cnman 36 Sep 26 15:08 ZhongHuaSong
[cnman@localhost FontGlyphs]$ cd ZhongHuaSong/
[cnman@localhost ZhongHuaSong]$ ls -l         
total 3444
drwxrwxrwx 2 cnman cnman  675840 Aug 12 23:39 Plane00
drwxrwxrwx 2 cnman cnman 1474560 Aug 12 21:13 Plane02
[cnman@localhost ZhongHuaSong]$ cd Plane00/
[cnman@localhost Plane00]$ ls -l
total 110212
-rwxrwxrwx 1 cnman cnman  595 Aug 12 22:38 U_003400.png
-rwxrwxrwx 1 cnman cnman  815 Aug 12 22:38 U_003401.png
-rwxrwxrwx 1 cnman cnman 1035 Aug 12 22:38 U_003402.png
...
-rwxrwxrwx 1 cnman cnman 1376 Aug 12 23:39 U_009FE8.png
-rwxrwxrwx 1 cnman cnman 1513 Aug 12 23:39 U_009FE9.png
-rwxrwxrwx 1 cnman cnman 1342 Aug 12 23:39 U_009FEA.png

@nobodxbodon
Copy link
Collaborator Author

可否尝试在交互环境里测试图片是否能加载, 如有错误信息请贴出:

$ python3
Python 3.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 05:52:31) 
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from tkinter import *
>>> root = Tk()
>>> path="FontGlyphs/ZhongHuaSong/Plane00/U_003400.png"
>>> image1=PhotoImage(file=path)
>>> label=Label(root, image=image1)
>>> label.image = image1
>>> label.pack()

到这里就应该显示:
screen shot 2018-09-26 at 7 36 14 pm

另外, 好像你重置了源码库?

@CNMan
Copy link
Owner

CNMan commented Sep 27, 2018

[cnman@localhost ~]$ cd UnicodeCJK-WuBi-master/
[cnman@localhost UnicodeCJK-WuBi-master]$ scl enable rh-python36 bash
[cnman@localhost UnicodeCJK-WuBi-master]$ python3
Python 3.6.3 (default, Jan  9 2018, 10:19:07) 
[GCC 4.8.5 20150623 (Red Hat 4.8.5-11)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from tkinter import *
>>> root = Tk()
>>> path="FontGlyphs/ZhongHuaSong/Plane00/U_003400.png"
>>> image1=PhotoImage(file=path)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/rh/rh-python36/root/usr/lib64/python3.6/tkinter/__init__.py", line 3539, in __init__
    Image.__init__(self, 'photo', name, cnf, master, **kw)
  File "/opt/rh/rh-python36/root/usr/lib64/python3.6/tkinter/__init__.py", line 3495, in __init__
    self.tk.call(('image', 'create', imgtype, name,) + options)
_tkinter.TclError: couldn't recognize data in image file "FontGlyphs/ZhongHuaSong/Plane00/U_003400.png"
>>> 

图片体积太大了,分离到一个独立的repo去了,你重新提交下pull request吧,不好意思

@CNMan
Copy link
Owner

CNMan commented Sep 27, 2018

https://stackoverflow.com/questions/15718663/tkinter-image-not-showing-or-giving-an-error

看这里说是tkinter只支持gif格式,我导了一个字,确实如此,gif格式能正常显示

>>> path="U_003400.gif"
>>> image1=PhotoImage(file=path)
>>> label=Label(root, image=image1)
>>> label.image = image1
>>> label.pack()
>>> 

@nobodxbodon
Copy link
Collaborator Author

也许是tk版本问题: https://stackoverflow.com/a/49945627/1536803
我的是8.6:

$ python3 -c 'import tkinter; print(tkinter.TkVersion);'
8.6

@CNMan
Copy link
Owner

CNMan commented Sep 27, 2018

>>> import tkinter; print(tkinter.TkVersion);
8.5

貌似要引入PIL才可以支持其他格式

@CNMan
Copy link
Owner

CNMan commented Sep 27, 2018

你还是完善其他功能吧,我这两天再导一套gif格式的就行了

@nobodxbodon
Copy link
Collaborator Author

再导一套gif格式的就行了

嗯, 如果方便的话还是把运行环境一致为好(tk版本), 以免以后碰到其他坑.

另外, 可否把源数据文件格式改为用逗号分隔? 现在要检测某列是否为空好像有点麻烦, 比如:

{某字}    xxxx    yyyy    1234

不知是否是06版为空. 如果逗号分隔, 下面精确表示06版为空:

{某字},xxxx,yyyy,,1234

下面是86版为空:

{某字},,xxxx,yyyy,1234

等等

@CNMan
Copy link
Owner

CNMan commented Sep 27, 2018

另外, 可否把源数据文件格式改为用逗号分隔?

完成

@CNMan
Copy link
Owner

CNMan commented Sep 28, 2018

@nobodxbodon 你新建个repo专门放wubicodeeditor.py吧,这样编辑器更新历史和编码更新历史分开比较好。

@nobodxbodon
Copy link
Collaborator Author

你新建个repo专门放wubicodeeditor.py吧

好的. 估计会拆成几个文件. 还有测试之类.

用逗号分隔的源数据还没push吧?

@CNMan
Copy link
Owner

CNMan commented Sep 28, 2018

好的. 估计会拆成几个文件. 还有测试之类.

嗯,再加个tk版本判断,<=8.5用GIF格式图片,>=8.6用PNG格式图片,RHEL仓库最新是8.5

右边“Unicode 编码”下面可以增加一个“Unicode 编码区”,数据在 https://github.com/CNMan/Unicode/blob/master/UCD/Blocks.txt

用逗号分隔的源数据还没push吧?

重新clone一下就是了

nobodxbodon pushed a commit to program-in-chinese/wubi_code_editor that referenced this pull request Sep 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants