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.
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!