Python3 网易有道词典结合PyInstaller,tkinter制作一个简单的中英文翻译exe文件

这是自己的一个小想法,但是最后还是经过2天的瞎鼓捣实验成果了。虽然界面很丑,但是我很喜欢它,因为有Dos黑窗口,少去了安装步骤,更多的是少去了广告,基于有道翻译里面的api接口,所以我不怕翻译的不准确啦

首先这里分三大步进行肢解:

一: 有道词典的API接口爬取:
二:tkinter 各种控件的使用:
三:PyInstaller 打包成exe文件,直接在桌面上进行应用:

首先:我们来获取有道词典的API接口;

打开网址:
网址 http://fanyi.youdao.com/
中文转英文的翻译.png

这里通过HttpFox 拦截请求中我们可以看到,我们在网址:http://fanyi.youdao.com/ 中输入中国的时候,调用了post接口,这里的post 参数我把它特别的截出来了,其中key 为i 的value值 是一个乱码的,这里后面会一会就有讲到,里面post参数都有罗列。

英文转中文的翻译.png

相对于中文的翻译,英文的就很好的看到了, 我们可以直接看到对于i的value值为china

通过查看网页源代码的方式查看有道翻译的js文件,来查看salt和sign是怎么生成的
这里的sign值是进行了md5加密来着

找到js文件,然后点击这个文件,跳转到这个源文件中,然后全选所有的代码,复制下来.png

贴上有道API代码的获取:

# -*- coding: utf-8 -*-
# @Time    : 2017/8/28 0:42
# @Author  : 蛇崽
# @Email   : [email protected]
# @File    : YouDaoTest.py

import urllib.request
import urllib.parse
import time
import random
import hashlib
import json

headers = {}
headers['Referer']='http://fanyi.youdao.com/'
headers['User-Agent']='Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.108 Safari/537.36 2345Explorer/8.7.0.16013'

timestamp = int(time.time() * 1000) + random.randint(0,10)

content = input('请输入您需要翻译的内容:')

u = "fanyideskweb"
d = content
f = str(timestamp)
c = "rY0D^0'nM0}g5Mm1z%1G4"

sign = hashlib.md5((u + d + f + c).encode('utf-8')).hexdigest()

data = {
    'i': content,
    'from': 'AUTO',
    'to': 'AUTO',
    'smartresult': 'dict',
    'client': 'fanyideskweb',
    'salt': timestamp,
    'sign': sign,
    'doctype': 'json',
    'version': '2.1',
    'keyfrom': 'fanyi.web',
    'action': 'FY_BY_CLICK',
    'typoResult': 'true'
}

data = urllib.parse.urlencode(data).encode('utf-8')
request = urllib.request.Request(url='http://fanyi.youdao.com/translate_o?smartresult=dict&smartresult=rule&sessionFrom=https://www.google.com/',method='POST',data=data,headers=headers)
response = urllib.request.urlopen(request)
result_str = response.read().decode('utf-8')
result_dict = json.loads(result_str)
print (result_dict["translateResult"][0][0]['tgt'])

这里采用的是自动翻译功能,没有使用手动

2 tkinter 各种控件的使用

这里学的也不多,用的tkinter是python自带的一个GUI编程,给出一些GUI资料。当时也是一路碰过来的,没有进行深入的研究,

这里罗列一些tkinter模块常用参数(python3)

1、使用tkinter.Tk() 生成主窗口(root=tkinter.Tk());
root.title(‘标题名’)      修改框体的名字,也可在创建时使用className参数来命名;
root.resizable(0,0)      框体大小可调性,分别表示x,y方向的可变性;
root.geometry(‘250x150’)  指定主框体大小;
root.quit()         退出;
root.update_idletasks()
root.update()      刷新页面;

2、初级样例:

import tkinter
root=tkinter.Tk() #生成root主窗口
label=tkinter.Label(root,text=’Hello,GUI’) #生成标签
label.pack() #将标签添加到主窗口
button1=tkinter.Button(root,text=’Button1’) #生成button1
button1.pack(side=tkinter.LEFT) #将button1添加到root主窗口 button2=tkinter.Button(root,text=’Button2’)
button2.pack(side=tkinter.RIGHT)
root.mainloop() #进入消息循环(必需组件)

3、tkinter中的15种核心组件:

Button   按钮;
Canvas   绘图形组件,可以在其中绘制图形;
Checkbutton 复选框;
Entry    文本框(单行);
Text 文本框(多行);
Frame   框架,将几个组件组成一组
Label    标签,可以显示文字或图片;
Listbox    列表框;
Menu    菜单;
Menubutton 它的功能完全可以使用Menu替代;
Message 与Label组件类似,但是可以根据自身大小将文本换行;
Radiobutton 单选框;
Scale    滑块;允许通过滑块来设置一数字值
Scrollbar 滚动条;配合使用canvas, entry, listbox, and text窗口部件的标准滚动条;
Toplevel 用来创建子窗口窗口组件。
(在Tkinter中窗口部件类没有分级;所有的窗口部件类在树中都是兄弟。)

4、组件的放置和排版(pack,grid,place)

pack组件设置位置属性参数:
after:     将组件置于其他组件之后;
before:    将组件置于其他组件之前;
anchor:    组件的对齐方式,顶对齐’n’,底对齐’s’,左’w’,右’e’
side:     组件在主窗口的位置,可以为’top’,’bottom’,’left’,’right’(使用时tkinter.TOP,tkinter.E);
fill 填充方式 (Y,垂直,X,水平)
expand 1可扩展,0不可扩展
grid组件使用行列的方法放置组件的位置,参数有:
column: 组件所在的列起始位置;
columnspam: 组件的列宽;
row:    组件所在的行起始位置;
rowspam:   组件的行宽;
place组件可以直接使用坐标来放置组件,参数有:
anchor:    组件对齐方式;
x:     组件左上角的x坐标;
y:    组件右上角的y坐标;
relx:  组件相对于窗口的x坐标,应为0-1之间的小数;
rely: 组件相对于窗口的y坐标,应为0-1之间的小数;
width: 组件的宽度;
heitht:   组件的高度;
relwidth: 组件相对于窗口的宽度,0-1;
relheight:  组件相对于窗口的高度,0-1;

5、使用tkinter.Button时控制按钮的参数:

anchor:      指定按钮上文本的位置;
background(bg)   指定按钮的背景色;
bitmap:      指定按钮上显示的位图;
borderwidth(bd)    指定按钮边框的宽度;
command:       指定按钮消息的回调函数;
cursor:     指定鼠标移动到按钮上的指针样式;
font:    指定按钮上文本的字体;
foreground(fg)     指定按钮的前景色;
height:     指定按钮的高度;
image:      指定按钮上显示的图片;
state:     指定按钮的状态(disabled);
text:     指定按钮上显示的文本;
width:      指定按钮的宽度
padx      设置文本与按钮边框x的距离,还有pady;
activeforeground    按下时前景色
textvariable    可变文本,与StringVar等配合着用

6、文本框tkinter.Entry,tkinter.Text控制参数:

background(bg)    文本框背景色;
foreground(fg) 前景色;
selectbackground   选定文本背景色;
selectforeground   选定文本前景色;
borderwidth(bd)   文本框边框宽度;
font  字体;
show    文本框显示的字符,若为*,表示文本框为密码框;
state    状态;
width      文本框宽度
textvariable    可变文本,与StringVar等配合着用

7、标签tkinter.Label组件控制参数:

Anchor     标签中文本的位置;
background(bg)    背景色;
foreground(fg)   前景色;
borderwidth(bd)   边框宽度;
width      标签宽度;
height     标签高度;
bitmap     标签中的位图;
font    字体;
image      标签中的图片;
justify     多行文本的对齐方式;
text        标签中的文本,可以使用’\n’表示换行
textvariable     显示文本自动更新,与StringVar等配合着用

8、单选框和复选框Radiobutton,Checkbutton控制参数:

anchor   文本位置;
background(bg)   背景色;
foreground(fg) 前景色;
borderwidth 边框宽度;
width    组件的宽度;
height    组件高度;
bitmap    组件中的位图;
image    组件中的图片;
font    字体;
justify    组件中多行文本的对齐方式;
text    指定组件的文本;
value    指定组件被选中中关联变量的值;
variable   指定组件所关联的变量;
indicatoron 特殊控制参数,当为0时,组件会被绘制成按钮形式;
textvariable 可变文本显示,与StringVar等配合着用

9、组图组件Canvas控制参数

background(bg)    背景色;
foreground(fg) 前景色;
borderwidth     组件边框宽度;
width      组件宽度;
height    高度;
bitmap    位图;
image      图片;
绘图的方法主要以下几种:
create_arc 圆弧;
create_bitmap    绘制位图,支持XBM;
create_image    绘制图片,支持GIF(x,y,image,anchor);
create_line 绘制支线;
create_oval; 绘制椭圆;
create_polygon   绘制多边形(坐标依次罗列,不用加括号,还有参数,fill,outline);
create_rectangle   绘制矩形((a,b,c,d),值为左上角和右下角的坐标);
create_text 绘制文字(字体参数font,);
create_window   绘制窗口;
delete   删除绘制的图形;
itemconfig 修改图形属性,第一个参数为图形的ID,后边为想修改的参数;
move    移动图像(1,4,0),1为图像对象,4为横移4像素,0为纵移像素,然后用root.update()刷新即可看到图像的移动,为了使多次移动变得可视,最好加上time.sleep()函数;
只要用create_方法画了一个图形,就会自动返回一个ID,创建一个图形时将它赋值给一个变量,需要ID时就可以使用这个变量名。
coords(ID) 返回对象的位置的两个坐标(4个数字元组);

对于按钮组件、菜单组件等可以在创建组件时通过command参数指定其事件处理函数。方法为bind;或者用bind_class方法进行类绑定,bind_all方法将所有组件事件绑定到事件响应函数上。

10、菜单Menu

参数:
tearoff   分窗,0为在原窗,1为点击分为两个窗口
bg,fg    背景,前景
borderwidth   边框宽度
font 字体
activebackgound 点击时背景,同样有activeforeground,activeborderwidth,disabledforeground
cursor
postcommand
selectcolor   选中时背景
takefocus
title
type
relief
方法:
menu.add_cascade 添加子选项
menu.add_command 添加命令(label参数为显示内容)
menu.add_separator 添加分隔线
menu.add_checkbutton 添加确认按钮
delete 删除

11、事件关联

bind(sequence,func,add)——
bind_class(className,sequence,func,add)
bind_all(sequence,func,add)
事件参数:  
sequence         所绑定的事件;
func        所绑定的事件处理函数;
add        可选参数,为空字符或‘+’;
className          所绑定的类;

鼠标键盘事件
    <Button-1>            鼠标左键按下,2表示中键,3表示右键;
    <ButtonPress-1>        同上;
    <ButtonRelease-1>    鼠标左键释放;
    <B1-Motion>           按住鼠标左键移动;
    <Double-Button-1>     双击左键;
    <Enter>               鼠标指针进入某一组件区域;
    <Leave>               鼠标指针离开某一组件区域;
    <MouseWheel>         滚动滚轮;
    <KeyPress-A>         按下A键,A可用其他键替代;
    <Alt-KeyPress-A>      同时按下alt和A;alt可用ctrl和shift替代;
    <Double-KeyPress-A>    快速按两下A;
    <Lock-KeyPress-A>     大写状态下按A;

窗口事件
    Activate             当组件由不可用转为可用时触发;
    Configure            当组件大小改变时触发;
    Deactivate          当组件由可用转变为不可用时触发;
    Destroy              当组件被销毁时触发;
    Expose              当组件从被遮挡状态中暴露出来时触发;
    Unmap              当组件由显示状态变为隐藏状态时触发;
    Map                  当组件由隐藏状态变为显示状态时触发;
    FocusIn              当组件获得焦点时触发;
    FocusOut            当组件失去焦点时触发;
    Property             当窗体的属性被删除或改变时触发;
    Visibility           当组件变为可视状态时触发;

响应事件
event对象(def function(event)):
    char                按键字符,仅对键盘事件有效;
    keycode            按键名,仅对键盘事件有效;
    keysym             按键编码,仅对键盘事件有效;
    num                鼠标按键,仅对鼠标事件有效;
    type                 所触发的事件类型;
    widget               引起事件的组件;
    width,heigh        组件改变后的大小,仅Configure有效;
    x,y                鼠标当前位置,相对于窗口;
    x_root,y_root       鼠标当前位置,相对于整个屏幕

12、弹窗

messagebox._show函数的控制参数:
default 指定消息框按钮;
icon 指定消息框图标;
message    指定消息框所显示的消息;
parent 指定消息框的父组件;title 标题;
type 类型;
simpledialog模块参数:
title 指定对话框的标题;
prompt  显示的文字;
initialvalue 指定输入框的初始值;
filedialog    模块参数:
filetype    指定文件类型;
initialdir    指定默认目录;
initialfile    指定默认文件;
title     指定对话框标题
colorchooser模块参数:
initialcolor   指定初始化颜色;
title  指定对话框标题;

13、字体(font)

一般格式:
('Times -10 bold')
('Times',10,'bold','italic')    依次表示字体、字号、加粗、倾斜


补充:
config            重新配置
label.config(font='Arial -%d bold' % scale.get())
依次为字体,大小(大小可为字号大小),加粗
tkinter.StringVar    能自动刷新的字符串变量,可用setget方法进行传值和取值,类似的还有IntVar,DoubleVar...

然后我把有道api跟tkinter相互结合,做了一个很丑陋但是功能健在的GUI有道。(尴尬.big.png)

贴上组合后最后的代码:


# -*- coding: utf-8 -*-
# @Time    : 2017/8/29 2:06
# @Author  : 蛇崽
# @Email   : [email protected]
# @File    : SnakeSon_YouDao.py
from tkinter import *
import urllib.request
import urllib.parse
import time
import random
import hashlib
import json
headers = {}
headers['Referer']='http://fanyi.youdao.com/'
headers['User-Agent']='Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.108 Safari/537.36 2345Explorer/8.7.0.16013'


flag = True
class App(Frame):
    def __init__(self, master=None):
        Frame.__init__(self, master)
        self.pack()
        self.entrythingy = Entry(self)
        self.entrythingy.pack()

        self.button = Button(self, text="翻  译",width =40,height=2,
                             command=self.upper)
        self.button.pack(side='bottom',padx=5,pady=5)


        self.contents = StringVar()
        self.contents.set("中英文互换")
        self.entrythingy.config(textvariable=self.contents)

        self.entrythingy.bind('<Key-Return>', self.print_contents)


    def upper(self):
        strcontent = self.contents.get()
        timestamp = int(time.time() * 1000) + random.randint(0, 10)
        d = strcontent
        u = "fanyideskweb"
        f = str(timestamp)
        c = "rY0D^0'nM0}g5Mm1z%1G4"
        sign = hashlib.md5((u + d + f + c).encode('utf-8')).hexdigest()
        data = {
            'i': d,
            'from': 'AUTO',
            'to': 'AUTO',
            'smartresult': 'dict',
            'client': 'fanyideskweb',
            'salt': timestamp,
            'sign': sign,
            'doctype': 'json',
            'version': '2.1',
            'keyfrom': 'fanyi.web',
            'action': 'FY_BY_CLICK',
            'typoResult': 'true'
        }
        data = urllib.parse.urlencode(data).encode('utf-8')
        request = urllib.request.Request(
            url='http://fanyi.youdao.com/translate_o?smartresult=dict&smartresult=rule&sessionFrom=https://www.google.com/',
            method='POST', data=data, headers=headers)

        response = urllib.request.urlopen(request)
        result_str = response.read().decode('utf-8')
        result_dict = json.loads(result_str)
        finaleData = result_dict["translateResult"][0][0]['tgt']

        self.contents.set(finaleData)
        print('输入内容是:'+str(strcontent))
        print('输出内容是: ----->: ', self.contents.get())

    def print_contents(self, event):
        print("原内容是: ---->:", self.contents.get())

def about():
    print('hahfd')

def start_main():
    print('佛祖初始化.....................................')
    print("                   _ooOoo_\n")
    print("                  o8888888o\n")
    print("                  88\" . \"88\n")
    print("                  (| -_- |)\n")
    print("                  O\\  =  /O\n")
    print("               ____/`---'\\____\n")
    print("             .'  \\\\|     |//  `.\n")
    print("            /  \\\\|||  :  |||//  \\ \n")
    print("           /  _||||| -:- |||||-  \\ \n")
    print("           |   | \\\\\\  -  /// |   |\n")
    print("           | \\_|  ''\\---/''  |   |\n")
    print("           \\  .-\\__  `-`  ___/-. /\n")
    print("         ___`. .'  /--.--\\  `. . __\n")
    print("      .\"\" '<  `.___\\_<|>_/___.'  >'\"\".\n")
    print("     | | :  `- \\`.;`\\ _ /`;.`/ - ` : | |\n")
    print("     \\  \\ `-.   \\_ __\\ /__ _/   .-` /  /\n")
    print("======`-.____`-.___\\_____/___.-`____.-'======\n")
    print("                   `=---='\n")
    print("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n")
    print('佛祖启动成功....................................')
    print("     \t\t佛祖保佑                      永无BUG\n")
    print('###############################    蛇崽有道翻译小词典   ###################################\n')
    print('######   温馨提示[1]:  使用时,Windos系统DOS窗口请不要关闭                                 \n')
    print('######   温馨提示[2]:  若软件输出内容错误, 请不要惊慌,联系方式:QQ  643435675      \n')
    print('######   温馨提示[3]:  本软件纯属学习使用,请勿作为商用                             \n')
    print('######   本软件源码请访问:<p>http://www.jianshu.com/c/8d71ae9d3718</p>            \n ')
    print('#########################################################################################\n')
    root = App()
    root.master.title("有道简便翻译器")
    root.mainloop()

if __name__ == '__main__':
    start_main()

瞬间感觉装逼很low,额鹅鹅鹅,因为之前自己也是很小白,总觉着.exe文件很高大上,再加上能从黑窗口输出内容,更牛掰了。哎,

这就是怎么把有道API结合thinker进行GUI查单词,然后还不剩下最后一步:
打包成.exe文件

说起来,这个确实有些坎坷

因为自己用的一直是pycharm,很多三方引用库都是从pycharm中直接导入进去的,导致用pip的时候用的生疏,用的也是少了吧。

3 用PyInstaller生成.exe可执行文件

首先把pip配置好,这里我是直接配置到环境变量里面去了的,所以引入PyInstaller的话,可以直接使用命令:pip install PyInstaller

pip引入PyInstaller

这里我已经引入了PyInstaller库了,所以,我们可以进行下一步,
调用命令:

pyinstaller -F C:\Users\Administrator\PycharmProjects\PyStudy\YouDao\PyGUI3.py

最后会出现成功的字样:
~
55605 INFO: checking EXE
55627 INFO: Building EXE because out00-EXE.toc is non existent
55644 INFO: Building EXE from out00-EXE.toc
55664 INFO: Appending archive to EXE C:\Users\Administrator\dist\PyGUI3.exe
55694 INFO: Building EXE from out00-EXE.toc completed successfully.
~

PyInstaller生成可执行文件的路径

贴一下我pip PyInstaller 并且通过PyInstaller 命令生成.exe可执行文件的Dos命令行内容:

Microsoft Windows [版本 10.0.14393]
(c) 2016 Microsoft Corporation。保留所有权利。

C:\Users\Administrator>python
Python 3.5.2 (v3.5.2:4def2a2901a5, Jun 25 2016, 22:18:55) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> python setup.py install
  File "<stdin>", line 1
    python setup.py install
               ^
SyntaxError: invalid syntax
>>> pip openssl
  File "<stdin>", line 1
    pip openssl
              ^
SyntaxError: invalid syntax
>>> python setup.py openssl
  File "<stdin>", line 1
    python setup.py openssl
               ^
SyntaxError: invalid syntax
>>> exit()

C:\Users\Administrator>python
Python 3.5.2 (v3.5.2:4def2a2901a5, Jun 25 2016, 22:18:55) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> 1+1
2
>>> exit()

C:\Users\Administrator>pip

Usage:
  pip <command> [options]

Commands:
  install                     Install packages.
  download                    Download packages.
  uninstall                   Uninstall packages.
  freeze                      Output installed packages in requirements format.
  list                        List installed packages.
  show                        Show information about installed packages.
  check                       Verify installed packages have compatible dependencies.
  search                      Search PyPI for packages.
  wheel                       Build wheels from your requirements.
  hash                        Compute hashes of package archives.
  completion                  A helper command used for command completion.
  help                        Show help for commands.

General Options:
  -h, --help                  Show help.
  --isolated                  Run pip in an isolated mode, ignoring
                              environment variables and user configuration.
  -v, --verbose               Give more output. Option is additive, and can be
                              used up to 3 times.
  -V, --version               Show version and exit.
  -q, --quiet                 Give less output. Option is additive, and can be
                              used up to 3 times (corresponding to WARNING,
                              ERROR, and CRITICAL logging levels).
  --log <path>                Path to a verbose appending log.
  --proxy <proxy>             Specify a proxy in the form
                              [user:[email protected]]proxy.server:port.
  --retries <retries>         Maximum number of retries each connection should
                              attempt (default 5 times).
  --timeout <sec>             Set the socket timeout (default 15 seconds).
  --exists-action <action>    Default action when a path already exists:
                              (s)witch, (i)gnore, (w)ipe, (b)ackup, (a)bort.
  --trusted-host <hostname>   Mark this host as trusted, even though it does
                              not have valid or any HTTPS.
  --cert <path>               Path to alternate CA bundle.
  --client-cert <path>        Path to SSL client certificate, a single file
                              containing the private key and the certificate
                              in PEM format.
  --cache-dir <dir>           Store the cache data in <dir>.
  --no-cache-dir              Disable the cache.
  --disable-pip-version-check
                              Don't periodically check PyPI to determine
                              whether a new version of pip is available for
                              download. Implied with --no-index.

C:\Users\Administrator>pip install PyInstaller
Collecting PyInstaller
Requirement already satisfied: setuptools in c:\users\administrator\appdata\local\programs\python\python35\lib\site-packages (from PyInstaller)
Collecting future (from PyInstaller)
Installing collected packages: future, PyInstaller
Successfully installed PyInstaller-3.2.1 future-0.16.0

C:\Users\Administrator>pyinstaller
usage: pyinstaller [-h] [-v] [-D] [-F] [--specpath DIR] [-n NAME]
                   [--add-data <SRC;DEST or SRC:DEST>]
                   [--add-binary <SRC;DEST or SRC:DEST>] [-p DIR]
                   [--hidden-import MODULENAME]
                   [--additional-hooks-dir HOOKSPATH]
                   [--runtime-hook RUNTIME_HOOKS] [--exclude-module EXCLUDES]
                   [--key KEY] [-d] [-s] [--noupx] [-c] [-w]
                   [-i <FILE.ico or FILE.exe,ID or FILE.icns>]
                   [--version-file FILE] [-m <FILE or XML>] [-r RESOURCE]
                   [--uac-admin] [--uac-uiaccess] [--win-private-assemblies]
                   [--win-no-prefer-redirects]
                   [--osx-bundle-identifier BUNDLE_IDENTIFIER]
                   [--distpath DIR] [--workpath WORKPATH] [-y]
                   [--upx-dir UPX_DIR] [-a] [--clean] [--log-level LEVEL]
                   [--upx UPX]
                   scriptname [scriptname ...]
pyinstaller: error: the following arguments are required: scriptname

C:\Users\Administrator>pyinstaller -F C:\Users\Administrator\PycharmProjects\PyStudy\YouDao\PyGUI3.py
612 INFO: PyInstaller: 3.2.1
612 INFO: Python: 3.5.2
614 INFO: Platform: Windows-10-10.0.14393-SP0
635 INFO: wrote C:\Users\Administrator\PyGUI3.spec
689 INFO: UPX is not available.
722 INFO: Extending PYTHONPATH with paths
['C:\\Users\\Administrator\\PycharmProjects\\PyStudy\\YouDao',
 'C:\\Users\\Administrator']
748 INFO: checking Analysis
803 INFO: Building Analysis because out00-Analysis.toc is non existent
815 INFO: Initializing module dependency graph...
860 INFO: Initializing module graph hooks...
871 INFO: Analyzing base_library.zip ...
7739 INFO: running Analysis out00-Analysis.toc
8422 WARNING: lib not found: api-ms-win-crt-locale-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python35\python.exe
8842 WARNING: lib not found: api-ms-win-crt-stdio-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python35\python.exe
9266 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python35\python.exe
9684 WARNING: lib not found: api-ms-win-crt-heap-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python35\python.exe
10107 WARNING: lib not found: api-ms-win-crt-math-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python35\python.exe
10588 WARNING: lib not found: api-ms-win-crt-string-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python35\python35.dll
11174 WARNING: lib not found: api-ms-win-crt-conio-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python35\python35.dll
11636 WARNING: lib not found: api-ms-win-crt-locale-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python35\python35.dll
12100 WARNING: lib not found: api-ms-win-crt-environment-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python35\python35.dll
12551 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python35\python35.dll
12978 WARNING: lib not found: api-ms-win-crt-stdio-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python35\python35.dll
13414 WARNING: lib not found: api-ms-win-crt-filesystem-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python35\python35.dll
13848 WARNING: lib not found: api-ms-win-crt-time-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python35\python35.dll
14329 WARNING: lib not found: api-ms-win-crt-heap-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python35\python35.dll
14872 WARNING: lib not found: api-ms-win-crt-convert-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python35\python35.dll
15428 WARNING: lib not found: api-ms-win-crt-math-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python35\python35.dll
15868 WARNING: lib not found: api-ms-win-crt-process-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python35\python35.dll
16315 WARNING: lib not found: api-ms-win-crt-string-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python35\VCRUNTIME140.dll
16754 WARNING: lib not found: api-ms-win-crt-stdio-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python35\VCRUNTIME140.dll
17188 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python35\VCRUNTIME140.dll
17623 WARNING: lib not found: api-ms-win-crt-heap-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python35\VCRUNTIME140.dll
18093 WARNING: lib not found: api-ms-win-crt-convert-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python35\VCRUNTIME140.dll
18099 INFO: Caching module hooks...
18128 INFO: Analyzing C:\Users\Administrator\PycharmProjects\PyStudy\YouDao\PyGUI3.py
18693 INFO: Loading module hooks...
18694 INFO: Loading module hook "hook-encodings.py"...
19107 INFO: Loading module hook "hook-_tkinter.py"...
19552 WARNING: lib not found: api-ms-win-crt-string-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python35\DLLs\_tkinter.pyd
19983 WARNING: lib not found: api-ms-win-crt-stdio-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python35\DLLs\_tkinter.pyd
20416 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python35\DLLs\_tkinter.pyd
21168 INFO: checking Tree
21169 INFO: Building Tree because out00-Tree.toc is non existent
21186 INFO: Building Tree out00-Tree.toc
21316 INFO: checking Tree
21316 INFO: Building Tree because out01-Tree.toc is non existent
21333 INFO: Building Tree out01-Tree.toc
21388 INFO: Loading module hook "hook-xml.py"...
21803 INFO: Loading module hook "hook-pydoc.py"...
21872 INFO: Looking for ctypes DLLs
21893 INFO: Analyzing run-time hooks ...
21905 INFO: Including run-time hook 'pyi_rth__tkinter.py'
21928 INFO: Looking for dynamic libraries
22454 WARNING: lib not found: api-ms-win-crt-string-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python35\DLLs\_ssl.pyd
22923 WARNING: lib not found: api-ms-win-crt-environment-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python35\DLLs\_ssl.pyd
23353 WARNING: lib not found: api-ms-win-crt-stdio-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python35\DLLs\_ssl.pyd
23789 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python35\DLLs\_ssl.pyd
24333 WARNING: lib not found: api-ms-win-crt-filesystem-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python35\DLLs\_ssl.pyd
24850 WARNING: lib not found: api-ms-win-crt-utility-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python35\DLLs\_ssl.pyd
25424 WARNING: lib not found: api-ms-win-crt-heap-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python35\DLLs\_ssl.pyd
25855 WARNING: lib not found: api-ms-win-crt-convert-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python35\DLLs\_ssl.pyd
26269 WARNING: lib not found: api-ms-win-crt-time-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python35\DLLs\_ssl.pyd
26698 WARNING: lib not found: api-ms-win-crt-conio-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python35\DLLs\_ssl.pyd
27216 WARNING: lib not found: api-ms-win-crt-string-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python35\DLLs\unicodedata.pyd
27650 WARNING: lib not found: api-ms-win-crt-stdio-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python35\DLLs\unicodedata.pyd
28096 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python35\DLLs\unicodedata.pyd
28541 WARNING: lib not found: api-ms-win-crt-string-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python35\DLLs\_ctypes.pyd
28962 WARNING: lib not found: api-ms-win-crt-stdio-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python35\DLLs\_ctypes.pyd
29382 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python35\DLLs\_ctypes.pyd
29825 WARNING: lib not found: api-ms-win-crt-stdio-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python35\DLLs\pyexpat.pyd
30274 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python35\DLLs\pyexpat.pyd
30736 WARNING: lib not found: api-ms-win-crt-utility-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python35\DLLs\pyexpat.pyd
31159 WARNING: lib not found: api-ms-win-crt-time-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python35\DLLs\pyexpat.pyd
31605 WARNING: lib not found: api-ms-win-crt-heap-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python35\DLLs\pyexpat.pyd
32061 WARNING: lib not found: api-ms-win-crt-string-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python35\DLLs\_hashlib.pyd
32512 WARNING: lib not found: api-ms-win-crt-environment-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python35\DLLs\_hashlib.pyd
32952 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python35\DLLs\_hashlib.pyd
33402 WARNING: lib not found: api-ms-win-crt-stdio-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python35\DLLs\_hashlib.pyd
33841 WARNING: lib not found: api-ms-win-crt-utility-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python35\DLLs\_hashlib.pyd
34259 WARNING: lib not found: api-ms-win-crt-time-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python35\DLLs\_hashlib.pyd
34774 WARNING: lib not found: api-ms-win-crt-convert-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python35\DLLs\_hashlib.pyd
35273 WARNING: lib not found: api-ms-win-crt-heap-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python35\DLLs\_hashlib.pyd
35709 WARNING: lib not found: api-ms-win-crt-conio-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python35\DLLs\_hashlib.pyd
36162 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python35\DLLs\select.pyd
36623 WARNING: lib not found: api-ms-win-crt-string-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python35\DLLs\_bz2.pyd
37043 WARNING: lib not found: api-ms-win-crt-stdio-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python35\DLLs\_bz2.pyd
37458 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python35\DLLs\_bz2.pyd
37870 WARNING: lib not found: api-ms-win-crt-heap-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python35\DLLs\_bz2.pyd
38293 WARNING: lib not found: api-ms-win-crt-math-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python35\DLLs\_bz2.pyd
38747 WARNING: lib not found: api-ms-win-crt-heap-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python35\DLLs\_lzma.pyd
39174 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python35\DLLs\_lzma.pyd
39598 WARNING: lib not found: api-ms-win-crt-string-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python35\DLLs\_socket.pyd
40058 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python35\DLLs\_socket.pyd
40479 WARNING: lib not found: api-ms-win-crt-string-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python35\DLLs\_tkinter.pyd
40894 WARNING: lib not found: api-ms-win-crt-stdio-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python35\DLLs\_tkinter.pyd
41312 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python35\DLLs\_tkinter.pyd
41777 WARNING: lib not found: api-ms-win-crt-string-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python35\DLLs\tcl86t.dll
42225 WARNING: lib not found: api-ms-win-crt-environment-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python35\DLLs\tcl86t.dll
42667 WARNING: lib not found: api-ms-win-crt-stdio-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python35\DLLs\tcl86t.dll
43115 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python35\DLLs\tcl86t.dll
43541 WARNING: lib not found: api-ms-win-crt-time-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python35\DLLs\tcl86t.dll
43953 WARNING: lib not found: api-ms-win-crt-utility-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python35\DLLs\tcl86t.dll
44368 WARNING: lib not found: api-ms-win-crt-heap-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python35\DLLs\tcl86t.dll
44896 WARNING: lib not found: api-ms-win-crt-convert-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python35\DLLs\tcl86t.dll
45423 WARNING: lib not found: api-ms-win-crt-math-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python35\DLLs\tcl86t.dll
45891 WARNING: lib not found: api-ms-win-crt-string-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python35\DLLs\tk86t.dll
46338 WARNING: lib not found: api-ms-win-crt-stdio-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python35\DLLs\tk86t.dll
46757 WARNING: lib not found: api-ms-win-crt-runtime-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python35\DLLs\tk86t.dll
47181 WARNING: lib not found: api-ms-win-crt-utility-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python35\DLLs\tk86t.dll
47592 WARNING: lib not found: api-ms-win-crt-time-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python35\DLLs\tk86t.dll
48001 WARNING: lib not found: api-ms-win-crt-heap-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python35\DLLs\tk86t.dll
48429 WARNING: lib not found: api-ms-win-crt-convert-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python35\DLLs\tk86t.dll
48860 WARNING: lib not found: api-ms-win-crt-math-l1-1-0.dll dependency of c:\users\administrator\appdata\local\programs\python\python35\DLLs\tk86t.dll
48892 INFO: Looking for eggs
48892 INFO: Using Python library c:\users\administrator\appdata\local\programs\python\python35\python35.dll
48909 INFO: Found binding redirects:
[]
48947 INFO: Warnings written to C:\Users\Administrator\build\PyGUI3\warnPyGUI3.txt
49113 INFO: checking PYZ
49113 INFO: Building PYZ because out00-PYZ.toc is non existent
49131 INFO: Building PYZ (ZlibArchive) C:\Users\Administrator\build\PyGUI3\out00-PYZ.pyz
50238 INFO: Building PYZ (ZlibArchive) C:\Users\Administrator\build\PyGUI3\out00-PYZ.pyz completed successfully.
50265 INFO: checking PKG
50266 INFO: Building PKG because out00-PKG.toc is non existent
50281 INFO: Building PKG (CArchive) out00-PKG.pkg
50351 INFO: Updating manifest in C:\Users\Administrator\AppData\Roaming\pyinstaller\bincache00_py35_64bit\python35.dll
50353 INFO: Updating resource type 24 name 2 language 1033
50423 INFO: Updating manifest in C:\Users\Administrator\AppData\Roaming\pyinstaller\bincache00_py35_64bit\_ssl.pyd
50424 INFO: Updating resource type 24 name 2 language 1033
50468 INFO: Updating manifest in C:\Users\Administrator\AppData\Roaming\pyinstaller\bincache00_py35_64bit\unicodedata.pyd
50469 INFO: Updating resource type 24 name 2 language 1033
50506 INFO: Updating manifest in C:\Users\Administrator\AppData\Roaming\pyinstaller\bincache00_py35_64bit\_ctypes.pyd
50507 INFO: Updating resource type 24 name 2 language 1033
50542 INFO: Updating manifest in C:\Users\Administrator\AppData\Roaming\pyinstaller\bincache00_py35_64bit\pyexpat.pyd
50545 INFO: Updating resource type 24 name 2 language 1033
50588 INFO: Updating manifest in C:\Users\Administrator\AppData\Roaming\pyinstaller\bincache00_py35_64bit\_hashlib.pyd
50589 INFO: Updating resource type 24 name 2 language 1033
50623 INFO: Updating manifest in C:\Users\Administrator\AppData\Roaming\pyinstaller\bincache00_py35_64bit\select.pyd
50624 INFO: Updating resource type 24 name 2 language 1033
50653 INFO: Updating manifest in C:\Users\Administrator\AppData\Roaming\pyinstaller\bincache00_py35_64bit\_bz2.pyd
50659 INFO: Updating resource type 24 name 2 language 1033
50693 INFO: Updating manifest in C:\Users\Administrator\AppData\Roaming\pyinstaller\bincache00_py35_64bit\_lzma.pyd
50696 INFO: Updating resource type 24 name 2 language 1033
50729 INFO: Updating manifest in C:\Users\Administrator\AppData\Roaming\pyinstaller\bincache00_py35_64bit\_socket.pyd
50736 INFO: Updating resource type 24 name 2 language 1033
50765 INFO: Updating manifest in C:\Users\Administrator\AppData\Roaming\pyinstaller\bincache00_py35_64bit\_tkinter.pyd
50775 INFO: Updating resource type 24 name 2 language 1033
50852 INFO: Updating manifest in C:\Users\Administrator\AppData\Roaming\pyinstaller\bincache00_py35_64bit\tk86t.dll
50854 INFO: Updating resource type 24 name 1 language 1033
55508 INFO: Building PKG (CArchive) out00-PKG.pkg completed successfully.
55605 INFO: Bootloader c:\users\administrator\appdata\local\programs\python\python35\lib\site-packages\PyInstaller\bootloader\Windows-64bit\run.exe
55605 INFO: checking EXE
55627 INFO: Building EXE because out00-EXE.toc is non existent
55644 INFO: Building EXE from out00-EXE.toc
55664 INFO: Appending archive to EXE C:\Users\Administrator\dist\PyGUI3.exe
55694 INFO: Building EXE from out00-EXE.toc completed successfully.

C:\Users\Administrator>

以上就是全部了。

看一下可执行文件的面貌吧:

这就是那个dos窗口加小应用窗口

dos窗口是特意放大的,⁄(⁄ ⁄•⁄ω⁄•⁄ ⁄)⁄,

是不是小的GUI窗口查单词很方便,直接调用的有道API,无毒,无广告,源码还开放,哈哈哈(路人懵逼五分钟.jpg)

小程序已上传Github: https://github.com/643435675/PyStudy

参考:
有道词典API:
http://www.jianshu.com/p/5001c75a23c4
PyInstaller生成EXE文件:
http://www.cnblogs.com/aland-1415/p/7112977.html
tkinter简单GUI基础:
http://www.cnblogs.com/aland-1415/p/6849193.html

版权声明:本文为xudailong_blog原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/xudailong_blog/article/details/77805179