# -*- coding: utf-8 -*- import easygui who = easygui.buttonbox("你想请谁吃饭 ?", "luckly question", ['我', '步步', '不请']) #如果不想右上角的关闭按钮能关闭,屏蔽所有的if who is None 部分 while who != '我': easygui.msgbox('why is not me,please once again choice') who = e
安装EasyGUI 教程http://www.cnblogs.com/zym941001/p/5323319.html Helloworld import easygui as g g.msgbox('Hello World!!') 2. 按钮组件 ①msgbox() msgbox(msg='(Your message goes here)',title='',ok_button='OK',image=None,root=None) ②ccbox() Ccbox(msg='Shall I con
一.猜字游戏 #猜字游戏(从1到10) import easygui as g import random g.msgbox('欢迎进入探险之路!') screct = random.randint(1,10) msg = '猜一下尘封的幸运数字是那个' title = '数字探险之路' guess = g.integerbox(msg,title,lowerbound=1,upperbound=10) while 1: if guess == screct: g.msgbox('很牛啊!')
#在35-3的基础上进行优化,当用户点击ok按钮的时候,对打开的文件进行检查是否修改.# 如果修改过,则提示覆盖保存.放弃保存.另存为并实现相应的功能 1 import easygui as g import os msg='浏览文件并打开' title='测试' default='D:\Python练习\*' fileType='全部文件' filePath=g.fileopenbox(msg,title,default,fileType) with open(filePath) as f: