#From Tkinter Import *"""need to use lowercase tkinter""" fromTkinterImport*Root=Tk () W= Label (root,text="Hello Fudianheg") W.pack () Root.mainloop ()"""Import (Tkinter) contains all of the classes, functions and other TK toolkit things that need to be done in most cases, can be used directly:""" #From tkinter Import *"""we'll start by creating a root window, which is a normal window with some decorations and a title bar, and you can only create one (root) window for each program, and it must be created before other windows are created. """ #root = Tk ()"""Next, we create a tab widget as the child of the root window""" #W = Label (root, text= "Hello Fudianheg") #W.pack ()"""a label part can display a piece of text or an icon or an image, and for this reason we use (text) to identify it. Next, we call this window's (pack) function to automatically resize the window according to the font size""" #Root.mainloop ()"""The window does not appear before the (mainloop) call"""The program would stayinchThe event Loop until we close the window. The event loop doesn ' t only handle events fromThe user (such as mouse clicks andKey presses)orThe windowing system (such as redraw events andwindow configuration messages), it also handle operations queued by Tkinter itself. Among these operations is geometry management (queued by the pack method) anddisplay updates. This also means that the application window would notappear before you enter the main loop."""
Translated by:
Http://effbot.org/tkinterbook/tkinter-hello-tkinter.htm
Python Tkinter Learning Notes (creation of the first simple window)