job pay = =none =none key=step adding gui the console-based interface approach of the preceding section worksand it may be sufficient for some users assuming that they are comfortable with typing commands in console window with just little extra workthoughwe can add gui that is more moderneasier to useless error proneand arguably sexier gui basics as we'll see later in this booka variety of gui toolkits and builders are available for python programmerstkinterwxpythonpyqtpythoncarddaboand more of thesetkinter ships with pythonand it is something of de facto standard tkinter is lightweight toolkit and so meshes well with scripting language such as pythonit' easy to do basic things with tkinterand it' straightforward to do more advanced things with extensions and oop-based code as an added bonustkinter guis are portable across windowslinux/unixand macintoshsimply copy the source code to the machine on which you wish to use your gui tkinter doesn' come with all the bells and whistles of larger toolkits such as wxpython or pyqtbut that' major factor behind its relative simplicityand it makes it ideal for getting started in the gui domain because tkinter is designed for scriptingcoding guis with it is straightforward we'll study all of its concepts and tools later in this book but as first examplethe first program in tkinter is just few lines of codeas shown in example - example - pp \preview\tkinter py from tkinter import label(text='spam'pack(mainloop(from the tkinter module (reallya module package in python )we get screen device ( "widget"construction calls such as labelgeometry manager methods such as packwidget configuration presets such as the top and right attachment side hints we'll use later for packand the mainloop callwhich starts event processing this isn' the most useful gui ever codedbut it demonstrates tkinter basics and it builds the fully functional window shown in figure - in just three simple lines of code its window is shown herelike all guis in this bookrunning on windows it works the same on other platforms ( mac os xlinuxand older versions of windows)but renders in with native look and feel on each sneak preview