📜  EasyGUI – 代码框

📅  最后修改于: 2022-05-13 01:54:56.895000             🧑  作者: Mango

EasyGUI – 代码框

代码框:用于向/从用户显示和获取文本形式的代码,即不是自动换行形式,文本可以使用任何键盘输入进行编辑,它以字符串的形式输入。它显示标题、要显示的消息、更改给定文本的位置和一对用于确认文本的“确定”、“取消”按钮。它类似于文本框,但用于显示代码文本,下面是输入框的样子

例子 :
在此我们将创建一个带有可编辑文本的代码框,并将根据更改后的文本在屏幕上显示特定文本,以下是实现

# importing easygui module
from easygui import *
  
# message to be displayed
message = "Below is the text to edit"
  
# window title
title = "Window Title GfG"
  
# long code text
text = """
  
EasyGUI 
is a module for very simple,
very easy GUI programming in Python.
EasyGUI 
is different from otherGUI generators 
in that EasyGUI is NOT event-driven.
  
"""
          
# creating a code box
output = codebox(message, title, text)
  
# showing the output
print("Alterted Text ")
print("================")
print(output)

输出 :

Alterted Text 
================
'gfg>
great
EasyGUI module
is a module for very simple,
very easy GUI programming in Python.
EasyGUI 
is different from otherGUI generators 
in that EasyGUI is NOT event-driven.

'/gfg>

另一个例子 :
这里我们将创建一个没有可编辑文本的代码框,并根据修改后的文本在屏幕上显示特定的文本,下面是实现

# importing easygui module
from easygui import *
  
# message to be displayed
message = "Below is the text to edit"
  
# window title
title = "Window Title GfG"
  
# creating a code box
output = codebox(message, title)
  
# showing the output
print("Alterted Text ")
print("================")
print(output)

输出 :

Alterted Text 
================
gfg
a
b
v
c
c
c


/gfg