Python GUI tkinter (1)

Source: Internet
Author: User

Tkinter is the standard GUI library in the python release version. That is to say, tkinter can be used after python is installed by default.

I have referenced a tutorial and wrote someCodeTry:

# File: test. pyfrom tkinter import * class app: def _ init _ (self, Master): Self. frame = frame (master) self. frame. pack () self. button = button (self. frame, text = 'quit', fg = 'red', command = self. frame. quit) self. button. pack (side = left) self. hi = button (self. frame, text = 'hello', command = self. hi) self. hi. pack (side = left) def HI (Self): Label = label (self. frame, text = 'hello, python! ') Label. Pack () root = TK () root. wm_title ('hello') root. wm_minsize (300,250) APP = app (Root) root. mainloop ()

It can be run, but the annoying thing is that there is always a command line interface after the graphical interface (in windows, click test. py, as shown in the result ):

... After a while, I changed the file name to test. pyw and OK. There is no command line:

This is the case !!! Continue my python journey...

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.