Home > Backend Development > Python Tutorial > How to use text box in python

How to use text box in python

(*-*)浩
Release: 2019-07-09 10:24:28
Original
7029 people have browsed it

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, ... )
Copy after login

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()
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template