python3 学习之路2
EasyGUI学习
官网:http://easygui.sourceforge.net/tutorial.html#using-easygui
In [14]: import easygui In [15]: easygui.msgbox("Hello, world!") Out[15]: 'OK' |
官方示例 from easygui import * msgbox("Hello, world!") |
|
|
In [17]: from easygui import * In [18]: msg = "Do you want to continue?" In [19]: title = "Please Confirm" In [20]: if ccbox(msg, title): ...: pass ...: else: ...: sys.exit(0) |
|
|
|
以下为官方实例 from easygui import * msgbox("Hello, world!")
msg ="What is your favorite flavor?" title = "Ice Cream Survey" choices = ["Vanilla", "Chocolate", "Strawberry", "Rocky Road"] choice = choicebox(msg, title, choices)
# note that we convert choice to string, in case # the user cancelled the choice, and we got None. msgbox("You chose: " + str(choice), "Survey Result")
msg = "Do you want to continue?" title = "Please Confirm" if ccbox(msg, title): # show a Continue/Cancel dialog pass # user chose Continue else: sys.exit(0) # user chose Cancel |
|
|
|
|
|
|
|
|
|
In [41]:from easygui import * In [42]: image = "F:\\resizeApi.gif" In [43]: msg = "Do you like this picture?" In [44]: choices = ["Yes","No","No opinion"] In [45]: reply = buttonbox(msg, image=image, choices=choices) |
|