Python Tkinter Learning Notes (creation of the first simple window)

Source: Internet
Author: User

#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)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.