python的图形用户界面介绍

大家好,本篇文章主要讲的是python的图形用户界面介绍,感兴趣的同学赶快来看一看吧,对你有帮助的话记得收藏一下,方便下次浏览

python的图形用户界面

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

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

在这里插入图片描述

总结

到此这篇关于python的图形用户界面介绍的文章就介绍到这了,更多相关python图形界面内容请搜索0133技术站以前的文章或继续浏览下面的相关文章希望大家以后多多支持0133技术站!

以上就是python的图形用户界面介绍的详细内容,更多请关注0133技术站其它相关文章!

赞(0) 打赏
未经允许不得转载:0133技术站首页 » python