Home  >  Article  >  Backend Development  >  How to use text box in python

How to use text box in python

(*-*)浩
(*-*)浩Original
2019-06-29 14:37:586995browse

The text box is one of the controls often used in GUI programming. It is a language transmission channel for interaction between users and programs. Here are some operations on the tkinter text box. I hope it will be useful to friends who need it.

How to use text box in python

Python Tkinter text box is used to allow the user to enter a line of text string. (Recommended learning: Python video tutorial)

If you need to enter multiple lines of text, you can use the Text component.

If you need to display one or more lines of text and do not allow users to modify it, you can use the Label component.

The syntax format is as follows:

w = Entry( master, option, ... )

master: The parent container of the button.

options: Optional options, that is, the settable attributes of the button. These options can be set in the form key = value, separated by commas.

Examples

#!/usr/bin/python
# -*- coding: UTF-8 -*-
 
from Tkinter import *
 
top = Tk()
L1 = Label(top, text="网站名")
L1.pack( side = LEFT)
E1 = Entry(top, bd =5)
E1.pack(side = RIGHT)
 
top.mainloop()

For more Python related technical articles, please visit the Python Tutorial column to learn!

The above is the detailed content of How to use text box in python. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:How to use python's whileNext article:How to use python's while