from tkinter import root tk(widget label(rootwidget config(text='hello gui world!'widget pack(side=topexpand=yesfill=bothroot title('gui py'root mainloop(the config method (which can also be called by its synonymconfigurecan be called at any time after construction to change the appearance of widget on the fly for instancewe could call this label' config method again later in the script to change the text that it displayswatch for such dynamic reconfigurations in later examples in this part of the book notice that this version also calls root title methodthis call sets the label that appears at the top of the windowas pictured in figure - in general termstop-level windows like the tk root here export window-manager interfaces-- things that have to do with the border around the windownot its contents figure - gui with expansion and window title just for funthis version also centers the label upon resizes by setting the expand and fill pack options in factthis version makes just about everything explicit and is more representative of how labels are often coded in full-blown interfacestheir parentsexpansion policiesand attachments are usually spelled out rather than defaulted one more for old timessake finallyif you are minimalist and you're nostalgic for old python coding stylesyou can also program this "hello worldexample as in example - example - pp \gui\intro\gui -old py--dictionary calls from tkinter import label(none{'text''hello gui world!'pack{'side''top'}}mainloop( graphical user interfaces