Using Tkinter to do Python GUI programming __ Programming

Source: Internet
Author: User
Tags pack python script

Python script has been written for a while, the advantages of the Python language does not have to say, but the GUI programming seems very few, looking for to find is the following two most reliable, but are the basis, really if the actual writing, but also to see the various code to do.

"Tkinter+programming+code+by+examples.pdf" http://vdisk.weibo.com/s/pNW4u

"Tkinter.pdf" Http://vdisk.weibo.com/s/pJ0Al


TopLevel's use has an article written particularly well, examples are very detailed: http://docstore.mik.ua/orelly/other/python2/Chapter%207.htm

My main use here is the Tkfiledialog Standard class library, which provides a variety of open methods that can be used as a binding callback function, for example:

Openfielbutton = Button (Root, Relief=ridge, bd=5,command=tkfiledialog.askopenfilename)


The method of binding the text widget to the scroll widget, python3.0 already has the Scrolltext class, and can be python2.x

Import tkinter

root = tkinter.tk ()
S = tkinter.scrollbar (root)
T = Tkinter.text (root

T.focus_set ()
S.pack (Side=tkinter.right, Fill=tkinter.y)
T.pack (Side=tkinter.left, FILL=TKINTER.Y
S.config (Command=t.yview)
T.config (yscrollcommand=s.set)

for I in range ():
     T. Insert (tkinter.end, "This are line%d\n"% i)

Tkinter.mainloop ()


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.