This article mainly introduces the Python standard library and third-party library. For more information, see the following section to describe the Python standard library and third-party library, for your reference:
Tkinter ----
This article mainly introduces how to use Python to develop a Windows GUI program entry instance. This article focuses on the software necessary for the development environment, and the code implementation is relatively simple, for more information, see wxPython. Write down some notes for your reference. On windows XP, configure the following environment:
1. install py
-
If you want to create a "start Python" shortcut, then refer to the 3rd method, go to "My Computer-->c:\python27", right-Python.exe select "Send to Desktop shortcut"
If you want to create a "Python shell window" shortcut, then refer to the 4th method, go to "My Computer-->c:\python27\lib\idlelib", right-idle.pyw select "Send to Desktop shortcut"
There are 1 ways to create a "
://blog.sina.com.cn/s/blog_62c832270101dca6.html2) http://www.cnblogs.com/goodhacker/p/3984377.html2. TkInterThis is a python-made tk/tcl shell. TK/TCL has a wide range of applications and is said to have a large user base. Moreover, after Tcl8, the App that uses it already can have the system native effect, no longer is that ugly and ugly interface.This is the official Python standard
One, the use of Python version of the machine1. This machine uses Python version as 3.6.2,windows system.Second, installation steps1. Start-run-cmd2, python3.x need to enter the Python installation location is the PIP directory, and then execute the PIP commandWhere: a pip folder under Python F:\Users\Administrator\App
A few simple GUI interfaces implemented with TkinterThe way to call Tkinter is simple, just a few lines of code1 Import Tkinter 2 top = tkinter.tk ()3# Code to add widgets'll go here ... 4 Top.mainloop ()Using the button ImportTkinterImportTkmessagebox Top=tkinter.tk ()#Add a function defHello (): Tkmessagebox.showinfo ("title","Hello python from S") #Add a ButtonOK = Tkint
. SetValue (File.read ()) File.close ()#save函数几乎和load一样, except that it has a ' W ' attribute and the Write method.#GetValue用于从文本区获得信息Def save (Event): file = open (filename. GetValue (), ' W ') file.write (contents. GetValue ()) File.close ()
Program Listing 6: The final program
import wxdef Load (event): File = open (filename. GetValue ()) contents. SetValue (File.read ()) File.close () def Save (event): File = open (filename. GetValue (), ' W ') file.write (contents.
Python GUI Programming
Use the tkinter module to create a simple GUI program.Tkinter's widgets include buttons, canvas, checkbutton, entry, frame, label, ListBox, menu, menubutton, message, radiobutton, scales, scrollbar, text, and toplevel.
Example:# This program displays an empty window.Import tkinterDef main ():Main_window = tkinter. TK ()Tkinter. mainloop ()
In order to solve the sublime text under the Python raw_input () function can not be effective, it started a GUI window to get input ideas, a start to use Tkinter, and then think of the next or use PyQt Bar, one of the code is not where to go, and Qt is obviously more beautiful View some. Encapsulated into a module input.py:#!/usr/bin/env python#-*-coding:utf-8-*
= Requests.get (self.url,st Ream=true) with open (filename, "WB") as Code:for Chunk in Self.r.iter_content (chunk_size=1024): #边下载边存硬 Disk if Chunk:code.write (chunk) time.sleep (1) #print ("\ n Download Complete") def DOWNP Rogress (self,filename): Self.filename=filename self.file_size=0 self.file_total=self.getsize () While Self.file_sizeThe source code is also uploaded to Http://down.51cto.com/data/2445550Summary and follow-upThis time is a
I. Introduction of Tkinter
Tkinter is a Python module, an interface called TCL/TK, which is a cross-platform scripting GUI interface. Tkinter is not the only Python graphics programming interface, but it is one of the more popular ones. The biggest feature is the cross-platform, the disadvantage is the performance is not good, the execution speed is slow.The gen
1. A simple example of CheckbuttonFrom tkinter Import *root = Tk () Checkbutton (root,text = ' python '). Pack () Root.mainloop ()2. Set the callback function for CheckbuttonFrom Tkinter import *def Callcheckbutton (): print (' I check this button ') root = Tk () Checkbutton (root,text = ' Check P Ython ', command = Callcheckbutton). Pack () #不管Checkbutton的状态如何, this callback function will be called root.mainloop ()3. Gets the value of Checkbuton
point.So how do you make changes to the function variables? It's really simple, define a list, and then convert the list to tuples. The modified function is as follows:Def changeitems ():Tnames.append (' Java ')Cnames.set (Tuple (tnames))root = tkinter.tk ()Root.geometry (' +400+200 ')Root.minsize (400,200)Root.title ("Test")Tnames = [' Python ', ' TCL ', ' Ruby ']CNAMEs = Stringvar ()Cnames.set (Tuple (tnames))L = Listbox (root, listvariable = Cname
Since most of the basics have been learned in the early stages, it is an intermediate stage for an in-depth understanding of the basics and Python usage. Open the first article on the GUI-related, in order to strengthen the sensory understanding.1. What is Wxpythonis a Python GUI toolkit.Download path: https://www.wxpy
The Python gui-tkinter tkmessagebox:tkmessagebox module is used to display message boxes in your application. This module provides a feature that you can use to display the appropriate messageThe Tkmessagebox module is used to display message boxes in your application. This module provides a feature that you can use to display the appropriate message.Some of these features are showinfo,showwarning,showerror
Use the Tkinter module in Python to create a GUI program instance, pythontkinter
Use the Tkinter module to create a simple GUI program.
Tkinter's Widgets include buttons, Canvas, Checkbutton, Entry, Frame, Label, Listbox, Menu, Menubutton, Message, Radiobutton, Scales, Scrollbar, TEXT, and Toplevel.
Example:Copy codeThe Code is as follows:# This program displays
Today can finally use Wxpython to develop GUI program, very happy. Write down some of the points of attention for reference. Under the Windows XP platform, you first need to configure the following environments:
1. First, install Python and add the Python/bin directory to path after installation.2. Install Wxpython, and be aware that the Wxpython version is cons
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.