首页 > 编程语言 > 详细

python-生僻字转拼音

时间:2018-08-25 23:47:30      阅读:278      评论:0      收藏:0      [点我收藏+]
 1 from  tkinter import Tk, Text, Button, END, N, GROOVE
 2 from pypinyin import pinyin
 3 root = Tk()
 4 root.geometry(540x200+600+340) #设置窗口大小
 5 root.title([汉字转拼音] Baylor的程序)  #窗口标题
 6 hztext = Text(root, width=20, height=10, font=微软雅黑,18) #窗口展示
 7 hztext.grid(row=0, column=0) #窗口位置
 8 
 9 #按钮  relief 设置框装饰  command 调用程序
10 Button(root, text=转换, font=微软雅黑,18,relief = GROOVE,command = lambda: pytext.delete(1.0, END) or pytext.insert(1.0, pinyin(hztext.get(1.0, END), heteronym=True)[0:-1])).grid(row=0, column=1)
11 
12 pytext = Text(root, width=20, height=10, font=微软雅黑,18)
13 pytext.grid(row=0, column=2)
14 root.mainloop()
15 
16 #tkinter 介绍: https://www.cnblogs.com/wozijisun/p/8794882.html

#无法输入,只能粘贴进去

技术分享图片

 

python-生僻字转拼音

原文:https://www.cnblogs.com/Baylor-Chen/p/9535860.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!