title: An Introduction to Tkinter subtitle: A User's Perspective author: Jeffrey B. Armstrong company: Approximatrix, LLC footer: PyOhio subfooter: 28 July 2012 h1. Introduction * Tkinter (or tkinter) ** Interface to Tcl/Tk ** The only GUI framework in the Python standard library ** Simple to use * The speaker ** Casual Tkinter user ** Some experience with other GUI toolkits h1. Opinions * Three types of people here ** Never used it ** Use it and Like it ** Hate it h1. Why Care? * Tkinter is part of the Python standard library * Lightweight * _Good enough_ ** In fact, it can be great! h1. The Past * Limited widget set * Unweildy _import_ * Considered ugly h1. The Present * Python 3.x ** Changed to Pythonic namespaces, like _tkinter_ ** Introduced... h1. Themed Tk * `ttk` module * Makes old Tkinter look pretty ** Kinda platform-specific... h1. Getting Started * Tk operates in "loop" that is transparent to the developer * Widgets are assigned parents, which contain other widgets, etc. * Layout managers handle widget placement * Widgets can have events "bound" to them and respond accordingly h1. Layout Managers * Tkinter provides three geometry managers ** absolute (avoid this) ** pack ** grid h1. pack Layout * Extremely simple * Specify a side * Parent sizes itself to minimally fit everything * Not particularly flexible for complex layouts h1. grid Layout * Closer to other toolkits * Frames are laid out in a grid ** Resizing can be handled via _expand_ arguments h1. Widgets * tkinter historically provides common, simple widgets * Considered a shortcoming ** Missing more advanced widgets h1. Widgets !{border:0px; float:right; height:14em}widgets.png!
| Button | Menu |
| Frame | Scale |
| Label | Scrollbar |
| Label with Image | Spinbox |
| Listbox | Text |