1. 相关文档

2. 安装步骤

① win+R 打开命令行窗口

② 按顺序输入如下代码

f:

cd "f:\codes\python\python\fishc\gui\easygui-docs-0.96"

dir

python setup.py install

它安装在 C:\Users\nigream Lin\AppData\Local\Programs\Python\Python37-32\Lib\site-packages

3. 导入gui

import easygui
easygui.msgbox('hello world!')
# 导入模块中的所有包
# 这样,调用方法就不用写模块名
# 这样可能会导致原程序中的同名方法被覆盖
from easygui import *
msgbox('你好!')
# 模块改昵称
import easygui as g
g.msgbox('hello world!')

4. 使用Easygui

import easygui as g
import sys while 1:
g.msgbox("嗨,欢迎进入第一个界面小游戏^ ^")
msg = "请问你希望在鱼c工作室学习到什么知识呢?"
title = "小游戏互动"
choices = ["谈恋爱", "编程","00XX","琴棋书画"]
choice = g.choicebox(msg, title, choices)
# note that we convert choice to string, in case
# the user cancelled the choice, and we got None .
g.msgbox("你的选择是:" + str(choice), "结果")
msg = "你希望重新开始小游戏吗?"
title = "请选择"
if g.ccbox(msg,title): # show a Continue/Cancel dialog
pass # user chose Continue
else:
sys. exit(0) # user chose Cancel

5. 注意:建议不要在IDLE上运行EasyGUI

EasyGui是运行在Tkinter上并拥有自身的事件循环,而IDLE也是Tkinter写的一个应用程序并也拥有自身的事件循环。因此当两者同时运行的时候,有可能会发生冲突,且带来不可预测的结果。因此如果你发现你的EasyGui程序有这样的问题,请尝试在IDLE外去运行你的程序。

6. 修改默认的样式

默认样式如下图所示:

修改choicebox控件的宽高

① 打开C:\Users\nigream Lin\AppData\Local\Programs\Python\Python37-32\Lib\site-packages\easygui.py

② ctrl+F搜索 def __choicebox

③ 找到 root_width = int((screen_width * 0.8)) 和 root_height = int((screen_height * 0.5))

④ 将0.8改为0.4,将0.5改为0.25

修改字体

① 打开C:\Users\nigream Lin\AppData\Local\Programs\Python\Python37-32\Lib\site-packages\easygui.py

② ctrl+F搜索 PROPORTIONAL_FONT

③ 找到 PROPORTIONAL_FONT_FAMILY = ("MS", "Sans", "Serif")

④ 将其改为 PROPORTIONAL_FONT_FAMILY = ("微软雅黑")

Python学习笔记——GUI的更多相关文章

  1. OpenCV之Python学习笔记

    OpenCV之Python学习笔记 直都在用Python+OpenCV做一些算法的原型.本来想留下发布一些文章的,可是整理一下就有点无奈了,都是写零散不成系统的小片段.现在看 到一本国外的新书< ...

  2. Python学习笔记,day5

    Python学习笔记,day5 一.time & datetime模块 import本质为将要导入的模块,先解释一遍 #_*_coding:utf-8_*_ __author__ = 'Ale ...

  3. 近期Python学习笔记

    近期Python 学习笔记--一篇文入门python 作者:Pleiades_Antares(www.cnblogs.com/irischen) 写在前面的话 想学Python已经许久,一年多以前(应 ...

  4. python学习笔记目录

    人生苦短,我学python学习笔记目录: week1 python入门week2 python基础week3 python进阶week4 python模块week5 python高阶week6 数据结 ...

  5. Python学习笔记之基础篇(-)python介绍与安装

    Python学习笔记之基础篇(-)初识python Python的理念:崇尚优美.清晰.简单,是一个优秀并广泛使用的语言. python的历史: 1989年,为了打发圣诞节假期,作者Guido开始写P ...

  6. python学习笔记整理——字典

    python学习笔记整理 数据结构--字典 无序的 {键:值} 对集合 用于查询的方法 len(d) Return the number of items in the dictionary d. 返 ...

  7. VS2013中Python学习笔记[Django Web的第一个网页]

    前言 前面我简单介绍了Python的Hello World.看到有人问我搞搞Python的Web,一时兴起,就来试试看. 第一篇 VS2013中Python学习笔记[环境搭建] 简单介绍Python环 ...

  8. python学习笔记之module && package

    个人总结: import module,module就是文件名,导入那个python文件 import package,package就是一个文件夹,导入的文件夹下有一个__init__.py的文件, ...

  9. python学习笔记(六)文件夹遍历,异常处理

    python学习笔记(六) 文件夹遍历 1.递归遍历 import os allfile = [] def dirList(path): filelist = os.listdir(path) for ...

随机推荐

  1. MAC常用的快捷键

    MAC上剪切文件: 首先command+C 然后command+option+V

  2. 17、生命周期-BeanPostProcessor在Spring底层的使用

    17.生命周期-BeanPostProcessor在Spring底层的使用 bean赋值.注入其他组件.@Autowired注解.生命周期注解.@Async --都是 BeanPostProcesso ...

  3. CAZAC序列

    定义: CAZAC(Const Amplitude Zero Auto-Corelation),即为恒包络零自相关序列. 性质: 1,恒包络特性:任意长度的CAZAC序列幅值恒定. 2,理想的周期自相 ...

  4. linux重启之后No CUDA-supporting devices found!

    实验室做并行计算的服务重启后,采用cuda接口的应用程序vasp_gpu,运行时提示: CUDA Error in cuda_main.cu, line 144: unknown error No C ...

  5. MySQL Index 索引提示:force or use

    一.使用索引提示(Index Hint)的条件 1.Mysql优化器错误的选择了某个索引.这种情况很少发生,需要做数据库的表.索引的统计分析. 2.某个SQL语句可选择的索引非常多,这个时候优化器执行 ...

  6. 应用webservice实现公网天气查询

    1. wsdl网址:http://ws.webxml.com.cn/WebServices/WeatherWS.asmx?wsdl 2. URL:http://www.webxml.com.cn/zh ...

  7. Poj 2976 Dropping tests(01分数规划 牛顿迭代)

    Dropping tests Time Limit: 1000MS Memory Limit: 65536K Description In a certain course, you take n t ...

  8. Print工具类

    这篇文章已经废弃. 实际开发中,打印信息只会用日志框架(Log4j2). 受到Thinking in Java中静态引入(import static)的启发, Deolin也打算写一个方便自己的工具类 ...

  9. P2663 越越的组队

    原题链接  https://www.luogu.org/problem/P2663 很容易看出来是个背包问题嘛: 体积是总分的一半,求最高分,每个同学选或不选,是个 01背包问题. 自信地交上去之后发 ...

  10. Linux 修改文件夹的用户组权限

    将ubsadm文件夹所属用户修改为userschown -R ubsadm:users /home/ubsadm 此命令将用户123的用户组改为rootusermod -g 123 root