示例#1
0
import easygui as g
import sys

g.egdemo() #调用easygui的所有内置方法

g.msgbox('hello word')#显示hello word

g.msgbox('hello word','HELLO')#指定消息参数(hello word)和标题参数(HELLO)

g.msgbox('hello word','HELLO',ok_button = '确定!')#重写OK按钮内容


choice = ['yes','no']
reply = g.choicebox('hello , indian mi fans! are you ok?',choices = choice)
#选择

if g.ccbox('again ? ',choices = ('yes','no')):
    g.msgbox('its too late')#默认是pass
else:
    sys.exit(0)
#ccbox选择框,continue 或者cancel 并返回相应的值(continue返回1,cancel返回0)

g.buttonbox(msg='',title='',choice=('1','2','3'),image= None,root = None)
#buttonbox,返回点击按钮对应的值
#image 参数仅支持.gif格式的图像

g.buttonbox(msg='这是张图片',title='',choices=('yes','no'),image = 'C:\\Users\\MR.G\\Desktop\\test.gif')
#buttonbox中显示图片

g.enterbox(msg='请输入数据',title='',default='',strip = True,image = None,root = None)
#返回用户输入的数据,按照字符串格式返回,默认strip=True时去掉首位空格,如需要则设置strip = true
示例#2
0
import easygui as g
import sys
g.msgbox("杨宏兴,come on! you can do it!")

g.egdemo()
# while 1:
#     g.msgbox("嗨,欢迎进入第一个游戏界面!^_^")
#     msg = "请问你想成为什么样的人呢?"
#     title = "小游戏互动"
#     choices = ["科学家", "工程师", "医生", "程序员"]
#     choice = g.choicebox(msg, title, choices) #改行是将之前的msg,title,choice合并成一个选择窗口进行显示
#     g.msgbox("你的选择是:" + str(choice), "结果") #将choice的值显示出来
#     msg = "你想重新开始游戏吗?"
#     title = "请选择"
#     if g.ccbox(msg, title): #ccbox将msg和title合并,并提供继续和取消选择
#         pass     # 选择继续,到while第一行
#     else:       #选择取消
#         sys.exit(0)
示例#3
0
import easygui
easygui.egdemo()  # 可调出eg里的各种函数的功能框
easygui.msgbox('Hello,world(内容)', '赶海人生(标题)')
easygui.msgbox(msg='内容参数', title='标题参数', ok_button='按键参数')  # 确定按钮框
easygui.ccbox(msg='内容参数?', title='标题参数', choices=('Yes', 'No'))  # 选择判断框
easygui.buttonbox(msg='请选择人物?', title='赶海人生',
                  choices=('老四', '阿峰', '阿雄'))  # 多按钮设置框
easygui.boolbox(msg='请选择人物?', title='赶海人生', choices=('Yes', 'No'))  # 选择判断框
easygui.buttonbox(msg='请选择人物?',
                  title='赶海人生',
                  image='Pic_35.png',
                  choices=('老四', '阿峰', '阿雄'))
easygui.choicebox()  # 选择框
easygui.multchoicebox()  # 多选框
easygui.enterbox()  # 输入框
easygui.integerbox()  # 范围输入框
easygui.multenterbox()  # 多输入框
easygui.passwordbox()  # 密码输入框
easygui.multpasswordbox()  # 多维密码输入框
easygui.textbox()  # 文本显示框
easygui.codebox()  # 等宽字体显示框
easygui.diropenbox()  # 目录输出框
easygui.fileopenbox()  # 打开文件框(返回文件路径)
easygui.filesavebox()  # 文件保存框(选择文件保存路径)
easygui.exceptionbox()  # 异常处理框
示例#4
0
import checkModule

checkModule.exists('easygui')

import easygui

easygui.egdemo()
	
示例#5
0
def run():
    easygui.egdemo()  # 实现简单GUI功能的演示