美文网首页
python自学项目day6.图形用户界面入门

python自学项目day6.图形用户界面入门

作者: Clemente | 来源:发表于2017-11-19 16:44 被阅读10次
import easygui as g
import sys

while 1:
        g.msgbox("嗨,欢迎进入第一个界面小游戏")
        
        msg ="请问你给自己长相打多少分"
        title = "我有多少分"
        choices = ["0分","60","99少一点怕我膨胀","负分滚粗"]
        
        choice = g.choicebox(msg,title,choices)
        g.msgbox("你的选择:" + str(choice),"结果")
        
        msg = "你希望重新开始打分吗?"
        title = "请选择"
        
        if g.ccbox(msg,title):
                pass
        else:
                sys.exit(0)

image.png
image.png
image.png

msgbox 显示一个button OK按钮并显示文字!

image.png

choicebox 对话框


image.png

ccbox等于 继续continue or 取消cancel


image.png

用notepad++打开PYTHON目录下site-packages下的easygui进行更改

调整窗口大小

查找choicebox
boxRoot = Tk()
找到,并调整即可
root_width = int((screen_width * 0.4))
root_height = int((screen_height * 0.5))
root_xpos = int((screen_width * 0.1))
root_ypos = int((screen_height * 0.05))

调整窗口字体

找到PROPORTIONAL_FONT_FAMILY 更改你喜欢的字体


image.png

相关文章

网友评论

      本文标题:python自学项目day6.图形用户界面入门

      本文链接:https://www.haomeiwen.com/subject/satpvxtx.html