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. 关于pageHelper无法查到总数踩到的坑

    问题代码 PageHelper.startPage(pageNum,pageSize); List<pojoVo> pojoVo=robotService.getPageList(); P ...

  2. vue 配置CDN加速

    1.首先index.html 中配置cdn 引入 <!-- 引入样式 --> <link rel="stylesheet" href="//cdn.bo ...

  3. Air Raid POJ - 1422 【有向无环图(DAG)的最小路径覆盖【最小不相交路径覆盖】 模板题】

    Consider a town where all the streets are one-way and each street leads from one intersection to ano ...

  4. 最小生成树&&次小生成树

    对于一个边上具有权值的图来说,其边权值和最小的生成树叫做图G的最小生成树 求无向图最小生成树主要有prim和kruskal两种算法 1.prim 将点集V分成Va和Vb两部分,Va为已经连入生成树的点 ...

  5. Spoj Query on a tree SPOJ - QTREE(树链剖分+线段树)

    You are given a tree (an acyclic undirected connected graph) with N nodes, and edges numbered 1, 2, ...

  6. idea 启动 Error running 'XxGatewayApplication': Command line is too long. Shorten command line for XxGatewayApplication or also for Spring Boot default

    在idea workspace里 <component name="PropertiesComponent">标签下加入 <property name=" ...

  7. csps模拟73-74

    模拟73: T1:哔-------------------- sb模拟,然而一个小细节打炸了,不想解释(吐嘈大样例没有右移)... #include<iostream> #include& ...

  8. python写爬虫遇到需要解码js一些记录

    js在线格式化网站 https://beautifier.io/ Python 执行 JS 代码 NodeJS 安装方式 先解决 JS 环境,这里推荐安装 Node.js ,安装方便,执行效率也高. ...

  9. 启动maven项目时报错Failed to start component [StandardEngine[Tomcat]]: A child container failed during start

    详细错误信息:Failed to execute goal org.apache.tomcat.maven:tomcat7-maven-plugin:2.2:run (default-cli) on ...

  10. 网络文件共享服务—NFS服务

    NFS服务 NFS:Network File System 网络文件系统,基于内核的文件系统: Sun公司开发,通过使用NFS,用户和程序可以像访问本地文件一样访问远端系统上的文件,基于RPC(Rem ...