Skip to content
Related Articles

Related Articles

Improve Article
EasyGUI – Text Box
  • Last Updated : 22 Sep, 2020

Text Box : It is used to show and get the text to/from the user, text can be edited using any keyboard input, it takes input in form of string. It displays the title, message to be displayed, place to alter the given text and a pair of “Ok”, “Cancel” button which is used confirm the text. It is similar to enter text but used to show large text and it word-wrap the given text, below is how the enter box looks like

In order to do this we will use textbox method

Syntax : textbox(message, title, text)

Argument : It takes 3 arguments, first string i.e message/information to be displayed, second string i.e title of the window and third is string which is the editable text

Return : It returns the altered text and None if cancel is pressed



Example :
In this we will create a text box with editable text, and will show the specific text on the screen according to the altered text, below is the implementation




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

Output :

Alterted 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. geeksforgeeks

Another Example :
In this we will create a text box without any editable text, and will show the specific text on the screen according to the altered text, below is the implementation




# 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 multi password box
output = textbox(message, title)
  
# showing the output
print("Alterted Text ")
print("================")
print(output)

Output :

Alterted Text 
================
Welcome to geeksforgeeks ajkbkjbajxblcblc;c

 Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.  

To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning – Basic Level Course




My Personal Notes arrow_drop_up
Recommended Articles
Page :