Day 28 Python Assignment
Day 28 Python Assignment
grid is used to lay out widgets in a grid. Another answer says it "overlays a graph" which
is a bit of a misnomer. It doesn't overlay anything, it merely arranges widgets along row
and column boundaries. It is great for creating tables and other structured types of layouts.
pack lays things out along the sides of a box. It excels at doing layouts where everything
is on a single row or in a single column (think rows of buttons in a toolbar or dialog box).
It's also useful for very simple layouts such as a navigator on the left and a main work area
on the right. It can be used to create very complex layouts but it gets tricky until you fully
understand the packing algorithm.
You cannot use both grid and pack with widgets that have a common parent. Your app
may work but it is much more likely to get into an infinite loop as each manager tries to
layout the widgets, then the other notices the widgets change size and try to adjust, etc. etc.
The third manage is place. Place is great for doing either absolute positioning (ie: place
widget at a given x/y) or relative (eg: place a widget on the right edge of some other
widget).
While you cannot mix grid and pack within the same container (a container is typically a
frame), you can use both grid and pack within a single application. This is very, very
common since each has strengths and weaknesses. I use both on a regular basis.
<B1-Motion> The mouse is moved, with mouse button 1 being held down (use
B2 for the middle button, B3 for the right button).
<Double-Button-1> Button 1 was double clicked. You can use Double or Triple as
prefixes.
<Enter> The mouse pointer entered the widget (this event doesn’t mean
that the user pressed the Enter key!).
<FocusOut> Keyboard focus was moved from this widget to another widget.
<Return> The user pressed the Enter key. For an ordinary 102-key
PC-style keyboard, the special keys are Cancel (the Break
key), BackSpace, Tab, Return(the Enter key), Shift_L (any
Shift key), Control_L (any Control key), Alt_L (any Alt key),
Pause, Caps_Lock, Escape, Prior (Page Up), Next (Page Down),
End, Home, Left, Up, Right, Down, Print, Insert, Delete, F1,
F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, Num_Lock, and
Scroll_Lock.
<Key> The user pressed any key. The key is provided in the char
member of the event object passed to the callback (this is an
empty string for special keys).
<Shift-Up> The user pressed the Up arrow, while holding the Shift key
pressed. You can use prefixes like Alt, Shift, and Control.
<Configure> The widget changed size (or location, on some platforms). The
new size is provided in the width and height attributes of
the event object passed to the callback.
<MouseWheel> The user moved the mouse wheel up or down. At present, this
binding works on Windows and MacOS, but not under Linux.