| 
 | 
 
 
发表于 2020-7-6 13:58:52
|
显示全部楼层
 
 
 
 本帖最后由 yhhpf 于 2020-7-6 14:46 编辑  
 
其实我感觉小甲鱼写的听清楚了的,基础上的多看下吧。 
- import easygui as g
 
 - import sys
 
  
- while 1:#一直执行
 
 -     g.msgbox("嗨,欢迎进入第一个界面小游戏^_^")
 
 - #弹出信息框,包含参数:
 
 - #msgbox(msg='(Your message goes here)', title=' ', ok_button='OK', image=None, root=None)
 
  
-     msg = "请问你希望在鱼C工作室学习到什么知识呢?"
 
 - #为msg赋值,以供下方choicebox使用
 
  
-     title = "小游戏互动"
 
 - #为title赋值,以供下方choicebox使用
 
  
-     choices = ["谈恋爱", "编程", "OOXX", "琴棋书画"]
 
 - #为choices赋值,以供下方choicebox使用
 
  
-     choice = g.choicebox(msg, title, choices)
 
 - #设置选择框,包含参数:
 
  
- #choicebox(msg='Pick an item', title='', choices=[], preselect=0, callback=None, run=True)
 
 - #对应msg,title,choices为之前赋值的
 
  
-     # 注意,msgbox的参数是一个字符串
 
 -     # 如果用户选择Cancel,该函数返回None
 
 -     g.msgbox("你的选择是: " + str(choice), "结果")
 
 - #弹出提示框,其中str(choice)既为用户在choicebox选择的内容,title="结果"
 
  
-     msg = "你希望重新开始小游戏吗?"
 
 -     title = "请选择"
 
 - #为msg,title重新赋值,以供下方ccbox使用
 
  
-     # 弹出一个Continue/Cancel对话框
 
 -     if g.ccbox(msg, title):
 
 - #提供选择按钮ccbox,包含参数:
 
 - #ccbox(msg='Shall I continue?', title=' ', choices=('C[o]ntinue', 'C[a]ncel'), image=None, default_choice='C[o]ntinue', cancel_choice='C[a]ncel')
 
 - #返回True或者False
 
  
-         pass  # 如果用户选择Continue(既True)
 
 -     else:
 
 -         sys.exit(0)  # 如果用户选择Cancel(既False)
 
  复制代码 |   
 
 
 
 |