python的圖形用戶界面介紹
python的圖形用戶界面
我是大帥哥啊 python的圖形用戶界面msgbox的使用ccbox的使用buttonbox的使用buttonbox添加圖片 choicebox的使用multchoicebox的使用
msgbox的使用

magbox()函數(shù)顯示一個消息和提供一個ok的按鈕
示例1:
import easygui as AX
AX.msgbox("嗨,歡迎進入\n第一個\n界面小游戲","zhaojie")

ccbox的使用
ccbox() 函數(shù)提供一個選擇:C[o]ntinue 或C[a]ncel (對應的按下鍵盤‘o’或鍵盤‘a’代替鼠標操作,[]括起來的字母就是對應的按鍵,當然continue和cancel也可以根據(jù)自己的需求設計)
示例2:
import easygui as AX
import sys
msg = "請問,你是大帥哥嗎"
title = "魔鏡"
choices = ('是([y])','不是([n])')
AX.ccbox(msg ,title,choices)

buttonbox的使用
buttonbox()函數(shù)的用法:
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函數(shù)里面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()函數(shù)提供一個可供選擇的列表, 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圖形界面內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關文章希望大家以后多多支持腳本之家!
相關文章
基于TensorFlow的CNN實現(xiàn)Mnist手寫數(shù)字識別
這篇文章主要為大家詳細介紹了基于TensorFlow的CNN實現(xiàn)Mnist手寫數(shù)字識別,文中示例代碼介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們可以參考一下2020-06-06
Python Opencv中用compareHist函數(shù)進行直方圖比較對比圖片
這篇文章主要介紹了Python Opencv中用compareHist函數(shù)進行直方圖比較進行對比圖片,本文通過實例代碼給大家介紹的非常詳細,對大家的學習或工作具有一定的參考借鑒價值,需要的朋友可以參考下2020-04-04

