Python provides a library of multiple graphical development interfaces, several common Python GUI libraries are as follows:
Tkinter: The Tkinter module (TK interface) is the interface for Python's standard Tk GUI toolkit. Tk and Tkinter can be used on most Unix platforms and can also be applied to Windows and Macintosh systems. Subsequent versions of Tk8
Hello, Tkinter.
But enough talk. Some code instead.
As you know, the every serious tutorial should start with a "Hello World"-type example. In this overview, we'll show you the only one such example, but two.
Every serious tutorial starts with a "Hello World" example, and in order to keep this routine we will show you two examples.
The a pretty minimal version:
First of all, let's look at a pretty minimum version: Our primary
http://blog.csdn.net/xxb2008
#-*-coding:utf-8-*-"" "tkconstants.py--Constant class Tkinter Layout pack parameter Description fill--X horizontal Fill (default, components from top to bottom), y vertical padding (each component from left to right), both filled Expand-1 when the size of the parent frame changes, automatically expands the size, 0 is false side--the left right top bottom dock on which side of
The TopLevel (top-level window) component is similar to a frame component, but the TopLevel component is a stand-alone top-level window that usually has parts such as title bars, borders, and so on, and is the same as the root window created by TK (), sharing the same method.
When to use the TopLevel component.
TopLevel components are typically used to display additional windows, dialogs, or other pop-up windows.
In the following example, we add a b
Python provides a library for multiple graphic development interfaces. several commonly used PythonGUI libraries are as follows:
Python GUI Programming (Tkinter)
Python provides a library for multiple graphical development interfaces. several common Python GUI libraries are as follows:
Tkinter: Tkinter module ("Tk interface") is the interface of Python's standard
>>> from tkinter import * >>> ROOT=TK () Create a new >>> window=toplevel (Root) # Create a new frame, window is the child window of root >>> window.title ("New Window") #窗口的标题 changed to new Window ' > >> window.lower () #最小化这个window >>> window.lower () >>> window.lift (Root) #重新显示window to Raise this window to the top of the "stacking" order in the window manager, call this method with no argume
In the tkinter module of python, menus can also be customized by you.
Below is my demo
Running effect:
tkinter * number = number += 1 tk = tk.geometry( tk.title(% ( ( Command_button = Menubutton(mBar, text= underline= Command_button.pack(side=LEFT, padx= Command_button.menu = Command_b
It's probably one of those things that comes with a server through an application.1.GUIIt's tkinter.1 #-*-coding:utf-8-*-2 fromTkinterImport*3 ImportTkinter.filedialog4 ImportRequests5 6 7 defUpload ():8 Print('Upload')9Selectfilename = Tkinter.filedialog.askopenfilename (title='Select File')#Select FileTen OneR = Requests.post ('Http://127.0.0.1:8000/upload', files={'file': Open (Selectfilename,'RB')}) A Print(R.content.decode ('Utf-8')
Tkinter drawing GUI is simple and clear, make some simple GUI enough, currently encountered a problem is not to display multiple pictures at the same time (not found at the same time to display the solution),Back to the second, change to add an Update button, each time the button to update the image automatically, the comment out of the original kernel package, replaced by their own program can beImportTkinter as TK fromTkinterImport* fromTkinterImpor
In this paper, the Tkinter of Python development is introduced to realize the method of moving the graph with mouse. Share to everyone for your reference, as follows:
When you do this, the inspiration comes from a JS effect:
Two eyes move with mouse movement
Operating effect:
Code section:
From tkinter Import * #1. Gets the current center coordinate of the small circle (x1, y1) #2. Gets the center coordin
Recently learned Python has a period of time, but also wrote a number of small programs, but mainly are command line execution, has been trying to learn the GUI, considering the simplicity of TK, but also to meet the requirements of general procedures, decided to learn the next tkinter, ready to spend some time reading Python Tkinter The official introduction, and then write some small programs on their own
The design of the UI, the record of the control ID, is a tedious task.In addition, the assignment and reading data are cumbersome and very pythonic.Is there a god-horse approach to elegance? Life was short.Given that the control has a Name property, it is known through DIR (entry_obj) that it is stored in a _name attribute. The following code is then available:Entry (frame,name= ' your_id1 '). Grid (Row=x1,column=y1) Entry (
# Provides a iner that can be used for drawing. It supports basic geometric elements. When using Canvas for drawing, all operations are performed through Canvas, canvas (1) ''' not based on its element ''tkinter )'''
# Provides a Container that can be used for drawing. It supports basic geometric elements. When using Canvas for drawing, all operations are performed through Canvas, not through its elements.
# Handle or tag can be used for element r
This article Reprinted from: http://blog.csdn.net/jcodeer/article/details/1813077
'''Tkinter pack '''# Pack as a layout manager, which can be considered as an elastic container'''1. An empty widget '''# Do not use pack#-*-Coding: cp936 -*-From tkinter import *Root = TK ()# View the child components under the current root. The interpreter does not report an exception, indicating that the pack has been create
This article Reprinted from: http://blog.csdn.net/jcodeer/article/details/1811347
''' Text (2) in tkinter tutorials ''''''6. Use tags to specify text attributes '''# Create a tag with the specified background color#-*-Coding: cp936 -*-From tkinter import *Root = TK ()T = text (Root)# Create a tag whose foreground color is redT. tag_config ('A', foreground = 'red ')# Use tag 'A' to specify text attributesT.
This article Reprinted from: http://blog.csdn.net/jcodeer/article/details/1811803
'''Tkinter canvas (1 )'''# Provides a container that can be used for drawing. It supports basic geometric elements. When using canvas for drawing, all operations are performed through canvas, not through its elements.# Handle or tag can be used for element representation.'''1. The first canvas program '''#-*-Coding: cp936 -*-# Specify the canvas color as whiteFrom
# Checkbutton for Tkinter tutorials
# Checkbutton, also known as the multiple-choice button, can represent two states: On and Off. You can set a callback function. When you click this button, the callback function is called.
'''1. Simple Checkbutton example '''
# Create a Checkbutton and display the text as "python"
From Tkinter import *
Root = Tk ()
Checkbutton (root, text = 'python'). pack ()
Root. mainlo
Android uses Animation-list for frame-by-frame Animation and android for frame-by-frame Animation.What we want to achieve
Prepare resource files and place them in
res/drawableFile
Light01.png Light02.png Light03.pngWrite
loading.xmlPut in
res/drawable
In
activity_main.xmlIn the layout file, write
Write in Activity lik
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.