12.07.2015 Views

Tkinter reference: A GUI for Python

Tkinter reference: A GUI for Python

Tkinter reference: A GUI for Python

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

If you do not provide a sticky attribute, the default behavior is to center the widgetin the cell. You can position the widget in a corner of the cell by setting sticky to NE (top right),SE (bottom right), SW (bottom left), or NW (top left). You can position the widget against one side of the cell by setting sticky to N (topcenter), E (right center), S (bottom center), or W (left center). Set sticky to N+S to stretch the widget vertically but leave it centered horizontally. Set sticky to E+W to stretch it horizontally but leave it centered vertically. Set sticky=N+E+S+W to stretch the widget both horizontally and vertically to fillthe cell.2.2 Other grid management methodsw.grid_<strong>for</strong>get()This method makes widget w disappear from the screen. It still exists, it just isn’t visible.You can .grid() it to make it appear again, but it won’t remember its grid options.w.grid_propagate()Normally, all widgets “propagate” their dimensions, meaning that they adjust to fit thecontents. However, sometimes you want to <strong>for</strong>ce a widget to be a certain size, regardlessof the size of its contents. To do this, call w.grid_propagate(0) where w is the widgetwhose size you want to <strong>for</strong>ce.w.grid_remove()This method is like .grid_<strong>for</strong>get(), but its grid options are remembered, so if you.grid() it again, it will use the same grid configuration options.New Mexico Tech Computer Center <strong>Tkinter</strong> <strong>reference</strong>: Layout management Page 5

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!