[Python] introduction and use of easygui

1. What is easygui?

ttkbootstrap is a tkinter-based pop-up prompt library, using this tool can develop pop-up windows

2. Installation steps

Install command:pip install easygui

3. Start using

1. Multi-button pop-up window

from easygui import buttonbox
a = buttonbox("正文", "标题", ["按钮1", "按钮2", "按钮3", "按钮4", "按钮5"])
print(a)

picture

2. Selection box pop-up window

from easygui import choicebox
a = choicebox("正文", "标题", ["选择1号", "选择2号", "选择3号", "选择4号", "选择5号"])
print(a)

picture

3. Enter the pop-up window

from easygui import enterbox
a = enterbox("正文", "标题")
print(a)

picture

4. Enter the pop-up window [PRO]

from easygui import enterbox
a = enterbox("正文", "标题","默认输入")
print(a)

picture

5. Integer input pop-up window

from easygui import integerbox
a = integerbox("正文", "标题")
print(a)

picture

6. Integer input popup [PRO]

from easygui import integerbox
a = integerbox("正文", "标题","3")
print(a)

picture
7. Prompt pop-up window

from easygui import msgbox
a = msgbox("正文", "标题")
print(a)

picture

Four, show your skills

Well, I have almost learned easygui, let's fight it!

Code

import easygui as e
import sys
 
while True:
      e.msgbox ("嗨,欢迎进入小游戏")
      msg = "请问你希望学到什么知识呢?"
      title = "游戏小互动"
      choices = ["点赞","投币","加关注","施主,记得三联哦"]
      choices = e.choicebox(msg,title,choices)
      
      e.msgbox("您的选择是:"+str(choices),"结果")
      msg = "你希望重新开始小游戏吗?"
      title = "请选择"
      if e.ccbox(msg,title):
            pass
      else:
            sys.exit(0)

picture
picture
picture
picture

5. Summary time

The above is what I want to talk about today. This article only briefly introduces the use of easygui, and easygui allows us to create a simple user graphical interface and do some operations on it.

6. Article recommendation

1. [Python] Introduction and use of ttkbootstrap

Guess you like

Origin blog.csdn.net/weixin_45953322/article/details/127989595