python的图形用户界面

python的图形用户界面

msgbox的使用

在这里插入图片描述
magbox()函数显示一个消息和提供一个ok的按钮
示例1:

import easygui as AX
AX.msgbox("嗨,欢迎进入\n第一个\n界面小游戏","zhaojie")

在这里插入图片描述

ccbox的使用

ccbox() 函数提供一个选择:C[o]ntinue 或C[a]ncel (对应的按下键盘‘o’或键盘‘a’代替鼠标操作,[]括起来的字母就是对应的按键,当然continue和cancel也可以根据自己的需求设计)

示例2:

import easygui as AX
import sys
   
msg = "请问,你是大帅哥吗"
title = "魔镜"
choices = ('是([y])','不是([n])')
AX.ccbox(msg ,title,choices)

在这里插入图片描述

buttonbox的使用

buttonbox()函数的用法:

buttonbox(msg = '',title = '',choices = ('button[1]','butthon[2]','button[3]'),image=None,default_choice=None,cancel_choice=None,callback=None,run=True)

示例3:

import easygui as AX
import sys
###写法1###
msg = '我是大帅哥吗?'
title = '魔镜'
choices = ('贼帅([1])','很帅([2])','最帅([3])')

AX.buttonbox(msg,title,choices)
###写法2###
AX.buttonbox(msg = '我是大帅哥吗?',title = '魔镜',choices = ('贼帅([1])','很帅([2])','最帅([3])'),image=None,default_choice=None,cancel_choice=None,callback=None,run=True)

在这里插入图片描述

buttonbox添加图片

在buttonbox里面显示图片:
大家注意到在上面buttonbox函数里面image = None,因此只需要将None改为对应的图片就行了

import easygui as AX
import sys

####写法1####
msg = '我是大帅哥吗?'
title = '魔镜'
choices = ('贼帅([1])','很帅([2])','最帅([3])')
image = 'OIP-C.jpg'
AX.buttonbox(msg,title,choices,image)

###写法2###
AX.buttonbox(msg = '我是大帅哥吗?',title = '魔镜',choices = ('贼帅([1])','很帅([2])','最帅([3])'),image='OIP-C.jpg',default_choice=None,cancel_choice=None,callback=None,run=True)

在这里插入图片描述

choicebox的使用

choicebox 的使用:

choicebox(msg='',title='',choices=[],preselect=0,callback=None,run=True)
choicebox()函数提供一个可供选择的列表,

import easygui as AX
import sys
AX.choicebox(msg='谁是大帅哥?',title='摸着自己的良心说',choices=["孙行者","者行孙","行者孙"],preselect=0,callback=None,run=True)

在这里插入图片描述

multchoicebox的使用

multchoicebox的用法:
与choicebox的用法一样,支持多项选择

import easygui as AX
import sys
AX.multchoicebox(msg='谁是大帅哥?',title='摸着自己的良心说',choices=["孙行者","者行孙","行者孙"],preselect=0,callback=None,run=True)

在这里插入图片描述

  • 4
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

CZU_zzjj

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值