网络编程
位置:首页>> 网络编程>> Python编程>> python的图形用户界面介绍

python的图形用户界面介绍

作者:CZU_zzjj  发布时间:2023-04-08 19:55:46 

标签:python,图形,界面

python的图形用户界面

我是大帅哥啊 python的图形用户界面msgbox的使用ccbox的使用buttonbox的使用buttonbox添加图片 choicebox的使用multchoicebox的使用

msgbox的使用

python的图形用户界面介绍

magbox()函数显示一个消息和提供一个ok的按钮
示例1:

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

python的图形用户界面介绍

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)

python的图形用户界面介绍

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)

python的图形用户界面介绍

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)

python的图形用户界面介绍

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)

python的图形用户界面介绍

multchoicebox的使用

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

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

python的图形用户界面介绍

来源:https://blog.csdn.net/Matlabonly/article/details/122411731

0
投稿

猜你喜欢

手机版 网络编程 asp之家 www.aspxhome.com