210.html

来自「Python Ebook Python&XML」· HTML 代码 · 共 489 行 · 第 1/2 页

HTML
489 行
字号
<p>
							<A namE="idx1073748436"></a>
							<a naMe="idx1073748437"></a>
							<p><TT CLass="monofont">column</tT>棤
    
								The number of the column where we want to place the widget.
							</P>
</P>
<P>
							<a namE="idx1073748438"></A>
							<A Name="idx1073748439"></a>
							<P><TT Class="monofont">columnspan</tt>棤
    
								This option defines the number of columns that must be occupied by the widget.
							</p>
</p>
<p>
							<a name="idx1073748440"></a>
							<a name="idx1073748441"></A>
							<p><tT claSs="monofont">rowspan</tt>棤
    
								This option defines the number of rows that must be occupied by the widget.<a Name="idx1073748442"></A>
									<A NAme="idx1073748443"></a>
									<a NAME="idx1073748444"></a>
									<a naME="idx1073748445"></A>
									<A name="idx1073748446"></A>
									<A NAme="idx1073748447"></a>
									<a name="idx1073748448"></a>
									<a name="idx1073748449"></a>
									<a name="idx1073748450"></A>
									<a nAme="idx1073748451"></a>
								</P>

						</p>
</bloCkquOTE>
				
				
					<H4>
						<tt clASS="monofont">place()</Tt>
					</h4>
					<p>Similar to all the other managers, this one is available for all Tkinter standard widgets as well. The place geometry manager enables you to explicitly set the position and size of each widget, which can be either in terms of absolute or relative coordinates. You should only consider using this manager when you are in need of placing a widget in a specific position that is not possible to set automatically. The next code exemplifies the use of place:</p>

					<PRE>
						
lbl = Label(root, text="Name:")
lbl.place(relx=0.5, rely=2, anchor=LEFT)

					</Pre>

					<p>The place geometry manager implements two methods: <tT CLAss="monofont">place</tt> and <tt class="monofont">place_configure.</tt> Both of them can use the following as <a name="idx1073748452"></a>
						<a NamE="idx1073748453"></a>
						<a nAme="idx1073748454"></a>arguments:</p>

					<BlocKQUOte>
<p>
							<a NAME="idx1073748455"></a>
							<a naME="idx1073748456"></A>
							<P><tt clASS="monofont">anchor</Tt>棤
    
								Defines the part of widget that must be placed on the given coordinates. Possible values are <tt class="monofont">N,</tt>
									<tt class="monofont">NE,</tt>
									<tT clAss="monofont">E,</tT>
									<tt clAss="monofont">SE,</tT>
									<TT Class="monofont">SW,</TT>
									<TT clasS="monofont">W,</TT>
									<Tt claSS="monofont">NW,</TT> and <tt class="monofont">CENTER.</tt> The default value is <tt class="monofont">NW,</tt> which is the top-left corner.
							</p>
</p>
<P>
							<a nAme="idx1073748457"></a>
							<A name="idx1073748458"></A>
							<p><tt CLASs="monofont">bordermode</tt>棤
    
								Defines whether the given coordinates must consider the border size or not. The possible values are respectively <tT CLAss="monofont">OUTSIDE</tt> and <TT CLass="monofont">INSIDE,</tT> which is the default value.
							</P>
</P>
<P>
							<a name="idx1073748459"></a>
							<a name="idx1073748460"></a>
							<a name="idx1073748461"></a>
							<a nAme="idx1073748462"></A>
							<p><tt Class="monofont">height,</Tt>
									<tt CLASs="monofont">width</tt>棤
    
								Define the widget's size in <i>pixels.</I>
								
							</P>
</P>
<P>
							<a namE="idx1073748463"></A>
							<A Name="idx1073748464"></a>
							<P><TT Class="monofont">in (in_)</tt>棤
    
								Places the widget in a position relative to the given <i>widget</i> Note that to use this option as a keyword option, you need to append an underscore to the option name.
							</p>
</p>
<p>
							<a name="idx1073748465"></a>
							<a naMe="idx1073748466"></a>
							<A namE="idx1073748467"></a>
							<a naMe="idx1073748468"></a>
							<p><TT CLass="monofont">relheight, relwidth</tT>棤
    
								Define the relative size of the widget to the reference widget defined by the <TT Class="monofont">in_</TT> option.
							</P>
</P>
<p>
							<a naME="idx1073748469"></A>
							<A name="idx1073748470"></a>
							<a name="idx1073748471"></a>
							<a name="idx1073748472"></a>
							<p><tt ClaSs="monofont">relx,</tt>
									<Tt claSs="monofont">rely</tt>棤
    
								Define the relative position of the widget to the reference widget defined by the <TT CLass="monofont">in_</tT> option, or to the parent widget when the <TT Class="monofont">in_</TT> option is not defined.
							</P>
</P>
<p>
							<a naME="idx1073748473"></A>
							<A name="idx1073748474"></a>
							<a name="idx1073748475"></a>
							<a name="idx1073748476"></a>
							<p><tt ClaSs="monofont">x,</tt>
									<Tt claSs="monofont">y</tt>棤
    
								Define the absolute position of the widget, and the default value is <TT CLass="monofont">0</tT> for each one of them.<A NAme="idx1073748477"></a>
									<a NAME="idx1073748478"></a>
									<a naME="idx1073748479"></A>
									<A name="idx1073748480"></a>
									<a name="idx1073748481"></a>
									<a name="idx1073748482"></a>
									<a naMe="idx1073748483"></a>
									<A namE="idx1073748484"></a>
									<a naMe="idx1073748485"></a>
									<a NAME="idx1073748486"></a>
									<a naME="idx1073748487"></A>
									<A name="idx1073748488"></A>
									<A NAme="idx1073748489"></a>
								
							</p>
</P>
</BLOckquote>
				
			</font>
<P><TABLE width="100%" border=0><TR valign="top"><TD><font size=1 color="#C0C0C0"><br></font></TD><TD align=right><font size=1 color="#C0C0C0">Last updated on 1/30/2002<br>Python Developer's Handbook, &copy;&nbsp;2002 Sams Publishing</font></TD></TR></TABLE></P>
<TABLE border=0 width="100%" cellspacing=0 cellpadding=0><TR><td align=left width="15%" class="headingsubbarbg"><a href="209.html" title="Tkinter"><font size="1">&lt;&nbsp;BACK</font></a></td><td align=center width="70%" class="headingsubbarbg"><font size="1"><a href="popanote.asp?pubui=oreilly&bookname=0672319942&snode=210" target="_blank" title="Make a public or private annnotation">Make Note</a> | <a href="210.html" title="Use a Safari bookmark to remember this section">Bookmark</a></font></td><td align=right width="15%" class="headingsubbarbg"><a href="211.html" title="Handling Tkinter Events"><font size="1">CONTINUE&nbsp;&gt;</font></a></td></TR></TABLE>
</TD></TR></TABLE>
<br><TABLE width=100% bgcolor=white border=0 cellspacing=0 cellpadding=5><TR><TD><H4 class=Title>Index terms contained in this section</H4>
<font size=2>
 <a href="#idx1073748455">anchor argument</a><BR>
 <a href="#idx1073748407">anchor option</a><BR>
arguments<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="#idx1073748456">anchor</a><BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="#idx1073748458">bordermode</a><BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="#idx1073748460">height</a><BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="#idx1073748464">in (in )</a><BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="#idx1073748452">place() and place_configure() methods</a> <a href="#idx1073748487">2nd</a><BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="#idx1073748466">relheight</a><BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="#idx1073748468">relwidth</a><BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="#idx1073748470">relx</a><BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="#idx1073748472">rely</a><BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="#idx1073748462">width</a><BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="#idx1073748474">x</a><BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="#idx1073748476">y</a><BR>
 <a href="#idx1073748457">bordermode argument</a><BR>
classes<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="#idx1073748401">grid</a><BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="#idx1073748399">pack</a><BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="#idx1073748403">place</a><BR>
 <a href="#idx1073748436">column option</a><BR>
 <a href="#idx1073748438">columnspan option</a><BR>
 <a href="#idx1073748420">expand option</a><BR>
 <a href="#idx1073748422">fill option</a><BR>
geometry management<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="#idx1073748413">methods, Tkinter module</a> <a href="#idx1073748446">2nd</a> <a href="#idx1073748481">3rd</a><BR>
graphical user interfaces (GUIs)<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Tkinter<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="#idx1073748410">geometry management methods</a> <a href="#idx1073748443">2nd</a> <a href="#idx1073748478">3rd</a><BR>
 <a href="#idx1073748400">grid class</a><BR>
 <a href="#idx1073748431">grid() method</a> <a href="#idx1073748450">2nd</a><BR>
 <a href="#idx1073748459">height argument</a><BR>
 <a href="#idx1073748463">in (in ) argument</a><BR>
interfaces<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;graphical user (GUI)<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="#idx1073748411">Tkinter</a> <a href="#idx1073748444">2nd</a> <a href="#idx1073748479">3rd</a><BR>
 <a href="#idx1073748424">ipadx option</a><BR>
methods<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;geometry management<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="#idx1073748414">Tkinter module</a> <a href="#idx1073748447">2nd</a> <a href="#idx1073748482">3rd</a><BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="#idx1073748432">grid()</a> <a href="#idx1073748451">2nd</a><BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="#idx1073748405">pack()</a> <a href="#idx1073748418">2nd</a><BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;place configure()<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="#idx1073748454">arguments</a> <a href="#idx1073748489">2nd</a><BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="#idx1073748486">place()</a><BR>
modules<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Tkinter<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="#idx1073748412">geometry management methods</a> <a href="#idx1073748445">2nd</a> <a href="#idx1073748480">3rd</a><BR>
options<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="#idx1073748408">anchor</a><BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="#idx1073748437">column</a><BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="#idx1073748439">columnspan</a><BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="#idx1073748421">expand</a><BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="#idx1073748423">fill</a><BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="#idx1073748433">grid() method</a><BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="#idx1073748425">ipadx</a><BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="#idx1073748419">pack() method</a> <a href="#idx1073748430">2nd</a><BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="#idx1073748427">padx</a><BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="#idx1073748435">row</a><BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="#idx1073748441">rowspan</a><BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="#idx1073748429">side</a><BR>
 <a href="#idx1073748398">pack class</a><BR>
 <a href="#idx1073748404">pack() method</a> <a href="#idx1073748417">2nd</a><BR>
packing<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="#idx1073748415">widgets</a> <a href="#idx1073748448">2nd</a> <a href="#idx1073748483">3rd</a><BR>
 <a href="#idx1073748426">padx option</a><BR>
 <a href="#idx1073748406">parcels</a><BR>
 <a href="#idx1073748402">place class</a><BR>
place configure method()<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="#idx1073748453">arguments</a> <a href="#idx1073748488">2nd</a><BR>
 <a href="#idx1073748485">place() method</a><BR>
 <a href="#idx1073748465">relheight argument</a><BR>
 <a href="#idx1073748467">relwidth argument</a><BR>
 <a href="#idx1073748469">relx argument</a><BR>
 <a href="#idx1073748471">rely argument</a><BR>
 <a href="#idx1073748434">row option</a><BR>
 <a href="#idx1073748440">rowspan option</a><BR>
 <a href="#idx1073748428">side option</a><BR>
Tkinter module<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="#idx1073748409">geometry management methods</a> <a href="#idx1073748442">2nd</a> <a href="#idx1073748477">3rd</a><BR>
widgets<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="#idx1073748416">packing</a> <a href="#idx1073748449">2nd</a> <a href="#idx1073748484">3rd</a><BR>
 <a href="#idx1073748461">width argument</a><BR>
 <a href="#idx1073748473">x argument</a><BR>
 <a href="#idx1073748475">y argument</a><BR>
<BR>
</font></TD></TR></TABLE>




<!--EndOfBrowse-->

</TD></TR></TABLE>
<table width=100% border=0 cellspacing=0 cellpadding=0 bgcolor=#990000><tr><td><p align=center><font size=1 face="verdana,arial,helvetica" color=white>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?