python easygui进度条_Python模块EasyGui专题学习

o_B1_meitu_1.jpg

Python模块EasyGui专题学习

1.msgbox(msg,title,ok_button=“OK”,image="",root=None)

代码

import easygui as g

msg=g.msgbox("大家好","标题",ok_button="知道了")

print(msg) #显示“知道了” 默认返回OK 总结:返回按钮文字

2.ccbox(msg,title,choices=("",""),image=None)

代码(返回True或者False)

import easygui as g

import sys

if g.ccbox("这么晚了,还要继续么?","提问",choices=("还要","算了")):

g.msgbox("还是不玩了,早些休息吧!")

else:

sys.exit(0)

3.ynbox()与上面ccbox()代码功能一个样,省略。

4.buttonbox(msg,title,choices=("Y","N","U"),image,root)

代码 返回按钮文本,默认第一个

import easygui as g

me=g.buttonbox("请做出你的选择","标题",choices=("苹果","香蕉","西瓜"))

print(me)

5.indexbox(msg,title,choices=("",""),image) 返回的是序列号

import easygui as g

me=g.indexbox("选择那个哦?","标题",choices=("排骨","青菜","辣椒","冬瓜"))

print(me) #显示序列号 选择第一个则显示0

6.boolbox(msg,title,choices=("YES","NO"),image=None)

代码 返回True或者False

import easygui as g

me = g.boolbox("","",choices=("YES","NO"))

print(me)

7.buttonbox(msg,title,image,choices=("可爱","不可爱","财迷"))

代码

import easygui as g

e=g.buttonbox("","",image="xiu.gif",choices=("可爱","不可爱","财迷"))

print(e) #返回按钮信息

8.choicebox(msg,title,choices=())

代码 返回 OK 选项内容 或者 None

import easygui as g

e=g.choicebox("请选择其一!","提示",choices=("飞机","坦克","潜艇","飞船"))

print(e)

9 multchoicebox("请选择某些!","提示",choices=("飞机","坦克","潜艇","飞船"))

代码

import easygui as g

e = g.multchoicebox("请选择某些!","提示",choices=("飞机","坦克","潜艇","飞船"))

print(e)

运行结果:OK ["飞机","坦克"]

10.enterbox(msg,title,.....) 其中strip=True默认 意思是去除空格

代码 返回输入的内容

import easygui as g

e=g.enterbox("请输入文本","提示")

print(e)

11.integerbox(msg,title,lowerbound=,upperbound=,image=,root=None,...)

代码 只能输入整数型 而且限制大小范围

import easygui as g

e=g.integerbox("","",lowerbound=3,upperbound=8)

print(e) # 必须3<=x<=8

12.multenterbox() 提供多个输入框 不填为空字符串 取消返回列表值或者None

multenterbox(msg,title,fields=,values=)

代码 代码 代码 代码 代码 代码

import easygui as g

msg="请填写下列信息:"

title="账号中心"

xiangmu=["*姓名","*电话","QQ","Email"]

neirong=[]

neirong=g.multenterbox(msg,title,xiangmu)

print(neirong)

while True:

if neirong==None:

break

errmsg=""

for i in range(len(xiangmu)):

print(xiangmu[i]+" oooo "+neirong[i])

jianyi=xiangmu[i].strip()

if neirong[i].strip()=="" and jianyi[0]=="*":

errmsg+=("【%s】为必须填写项目! "%str(xiangmu[i]))

if errmsg=="":

break

neirong=g.multenterbox(errmsg,title,xiangmu,neirong)

mmsg="您填写的资料如下:\n\n"+str(neirong[0])+"\n"+str(neirong[1])+"\n"+str(neirong[2])+"\n"+str(neirong[3])

g.msgbox(mmsg,"提示!",image=r"C:\Users\Daodantou\Desktop\147.gif")

#print("您填写的资料如下:%s"%str(neirong))

13.passwordbox(msg,title,image=,root=)

代码

import easygui as g

e=g.passwordbox("请输入你的密码","提示")

print(e)

14.multpasswordbox() 和multenterbox()同接口,最后一个为密码形式

import easygui as g

e=g.multpasswordbox("请输入用户名和密码","登陆",("用户:","密码"))

print(str(e))

15.textbox(msg,title,text="",codebox=0) 最后参数=1不换行,=0换行。

import easygui as g

e=g.textbox("请观察本文","显示","请填写如下信息!其中带*为必填项目。",codebox=1)

print(e)

16.diropenbox(msg,title,default="") 打开对话框,返回目录,目录带有完整路径 cancel为None

import easygui as g

d=g.diropenbox("","","C:")

print(d)

17.补充一个 fileopenbox()

import easygui as g

d=g.fileopenbox("文件选择对话框","选择一个文件,返回完整目录!",default="*.gif")

print(d)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值