V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
youthfire
V2EX  ›  Python

Python tkinter 按钮中输入 emoji 表情符号,会被重复显示

  •  
  •   youthfire · 2021-09-11 21:46:19 +08:00 · 1244 次点击
    这是一个创建于 928 天前的主题,其中的信息可能已经有所发展或是发生改变。

    本意是想给 tkinter 里的按钮增加 emoji 表情以便快速识别

    Button(root, text="明细查询", command=searchitem, font=("宋体", 15, 'bold')).grid(column=3, row=4)

    比如,在 text 这里增加一个 emoji 表情。添加后,表情可以显示出来,但任何表情都是会变成 2 个相同的。如果是只输入表情,不输入文字,就显示 2 个相同的表情。如果输入表情加文字,则文字会出现在 2 个重复表情的中间。如果不用 emoji 表情,用普通的 symbol 之类,可以正常显示。

    求教怎么解决?

    第 1 条附言  ·  2021-12-20 09:59:29 +08:00
    确认是 tk 的 bug ,Python 更新到 3.10.1 以后,tk 采用 8.6.12 ,已经完美支持在 button 上显示 emoji 了,效果很好
    2 条回复    2021-12-20 09:59:23 +08:00
    youthfire
        1
    youthfire  
    OP
       2021-09-12 16:05:56 +08:00
    在 Python 的 bug 报告处看到一些信息,大概率是 tcl/tk 处理 emoji 的能力问题
    https://bugs.python.org/issue44217
    youthfire
        2
    youthfire  
    OP
       2021-12-20 09:59:23 +08:00
    确认是 tk 的 bug ,Python 更新到 3.10.1 以后,tk 采用 8.6.12 ,已经完美支持在 button 上显示 emoji 了,效果很好
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3507 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 11:04 · PVG 19:04 · LAX 04:04 · JFK 07:04
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.