(8) Python tkinter-layout

Source: Internet
Author: User

Package Layout Pack ()

The current feeling about it is that when a form's object is set to the end of the property, it is used to bind to the form. After that, you can't set the properties anymore.

Name

Describe

Range of values

Expand

The side option is invalid when the value is "yes". The component is displayed in the center position of the parent accessory, and if the Fill option is "both", the remaining space of the parent component is populated.

"Yes", natural number, "no", 0

(The default value is "no" or 0)

Fill

Fills the space in the X (y) direction, fills the x direction when the property side= "top" or "bottom", fills the "Y" direction when the property side= "left" or "right", and fills the remaining space of the parent component when the expand option is "yes".

"X", "Y", "both"

(default value is optional)

IPADX, Ipady

The amount of space inside the component that is filled in the X (y) direction, the default unit is pixels, the selectable units are C (cm), m (mm),

I (Inch), p (the printer's point, or 1/27 inch), is used as a suffix after the value.

Non-negative floating point number

(default value is 0.0)

PADX, Pady

The amount of space that is filled in the X (y) direction outside the component, the default unit is pixels, the selectable units are C (cm), m (mm),

I (Inch), p (the printer's point, or 1/27 inch), is used as a suffix after the value.

Non-negative floating point number

(default value is 0.0)

Side

Defines which side of the parent component to dock on.

"Top", "bottom", "left", "right"

(Default to "top")

Before

Pack this component before the selected build object, similar to creating the component before creating the selected component.

Component Object After pack

After

Pack this component after the selected build object, similar to first creating the selected component and then this component.

Component Object After pack

In_

Use this component as a subcomponent of the selected build object, similar to specifying that the master of this component is the selected component.

Component Object After pack

Anchor

Alignment, left-aligned "W", right-aligned "E", top-aligned "n",

Bottom-aligned "s"

"N", "S", "W", "E", "NW", "SW", "se", "ne", "center"

(Default to "center")

Expand Property

Control appears in the middle of the form

Default is ' no '

1

T1=tkinter. button (form, text= ' button ') t1.configure (width = 30,height = 3) t1.pack (expand= "YES") 

The middle of this is to say two more words: if there are other controls, it is the center of the remaining space.

PS: Other controls will definitely be in the space of the positive row

2

If the Union fill property's ' Both ' it fills all the remaining controls

T1.pack (expand= "YES", fill= ' both ')

Side Property

Which side of the form is it affixed to, the default top

Four directions "Top", "bottom", "left" and "right"

Fill Property

Fill the entire x-axis, y-axis, or all

"X", "Y", "both" with side

PADX, Pady Property

Distance to external controls

Default unit is pixel

T2.pack (side= ' left ', padx= ', pady= ' 150 ')

X-axis moves right 20 pixels, y-axis moves down 150 pixels

IPADX, Ipady Property

The distance to the internal control

Anchor Property

On its way "n", "S", "W", "E", "NW", "SW", "se", "ne", "center" (Default to "center")

Grid layout grid (row=0,column=0)

(8) Python tkinter-layout

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.