The @ Overview TK is a (available for multi-platform) GUI library; Tkinter is the interface of the Python language to access the library and the standard for Python's GUI development;
@ First GUI interface
From tkinter Import *
# Create a program window
= Tk ()
# Create a control instance
lable = Label (
window, # parent Container
text= Hello " # opti
First, this semester began to learn python, but looked at Python2 and Python3, and finally chose the Python3In the spirit of familiarity with Python, and also want to do some small programs to increase their proficiency in python. So write a simple program, this small program to achieve the BASA64, base32 the addition of decoding. And added a MD5-generated featur
'''Scale of Tkinter tutorials '''
# Scale is the number range of the output range. You can specify the maximum value, minimum value, and stride value.
'''1. Create a Scale '''
From Tkinter import *
Root = Tk ()
Scale (root). pack ()
Root. mainloop ()
# Create a vertical Scale. The maximum value is 100, the minimum value is 0, and the step value is 1. This parameter is also the default Scale setting.
'''2. C
Python3.5 tkinter implements page Jump and python3.5tkinter
This article provides an example of how tkinter implements page Jump for your reference. The specific content is as follows:
Main function main. py
From tkinter import * from LoginPage import * root = Tk () root. title ('applet ') LoginPage (root) root. mainloop ()
LoginPage. py
From
This article Reprinted from: http://blog.csdn.net/jcodeer/article/details/1811300
# Tkinter: button (2)'''5. Specify the width and height of the button.Width: widthHeigth: HeightThree methods are used:1. Specify the width and height when creating the Button Object2. Use the attribute width and height to specify the width and height.3. Use the configure method to specify the width and height'''From tkinter i
' Tkinter Tutorial ' pack Chapter '
# Pack is a layout manager that can be viewed as an elastic container
' 1. An empty widget '
# does not use Pack
#-*-Coding:utf-8-* -From
tkinter import *
root = Tk ()
# View the subcomponents under the current root, the interpreter does not report an exception, the pack is created and can be used, the output is empty, that is, Root does not have any subcomponents.
print
This article Reprinted from: http://blog.csdn.net/jcodeer/article/details/1811348
''Tkinter text (3 )''''''14. Two built-in attributes of the custom tag '''''# Tag. First: insert text before the tag. This text is not included in this tag# Tag. Last: insert text after tag. This text is included in this tag#-*-Coding: cp936 -*-# Use the built-in attributes of tags to insert textFrom tkinter import *Root = TK
# Button in Tkinter tutorial (1)
# Button trigger event
'''1. A simple Button application '''
From Tkinter import *
# Define the callback function of the Button
Def helloButton ():
Print 'Hello click'
Root = Tk ()
# Specify the callback function of the Button through the command attribute
Button (root, text = 'Hello click', command = helloButton). pack ()
Root. mainloop ()
'''
Execution Result: After you c
# The entry chapter of Tkinter Tutorial
# entry used to enter Single-line text
' 1. The first entry program '
From Tkinter Import *
root = Tk ()
Entry (root,text = ' Input your text here '). Pack ()
Root.mainloop ()
# The above code is to create a entry object, and on the entry display ' Input your text here ', run this code, and do not see the text display, which can be different from lable and button, Ent
''' Scrollbar for Tkinter tutorials '''
# Scrollbar (scroll bar), which can be used independently, but most of them are used in combination with other controls (Listbox, Text, Canva, etc.)
'''1 create a Scrollbar '''
From Tkinter import *
Root = Tk ()
Scrollbar (root). pack ()
Root. mainloop ()
# A Scrollbar is displayed, but nothing can be done. slider cannot be dragged.
From
''' Tkinter Message '''
# Message is used to display text. Its usage is basically the same as that of Label.
'''1. Create a simple Message '''
From Tkinter import *
Root = Tk ()
Message (root, text = 'Hello message'). pack ()
Root. mainloop ()
# Run the program. After you see Hello, the Message is displayed in the next line. This is also a feature of Message. No Label.
'''2. If you do not want it to wrap,
# Tkinter tutorial entry
# Entry is used to input a single line of text.
'''1. The first entry program '''
From tkinter import *
Root = TK ()
Entry (root, text = 'input your text here '). Pack ()
Root. mainloop ()
# The above Code aims to create an entry object and display 'input your text here 'on the entry. Run this code and no text is displayed, different from lable and button, the text attribute of entr
"' The pack of the Tkinter tutorial '
# pack is a layout manager that can be viewed as a flexible container
' 1. An empty widget '
# Do not use Pack
#-*-coding:cp936-*-
From Tkinter Import *
root = Tk ()
# View the subcomponents under the current root, the interpreter does not report an exception, the pack is created and can be used, the output is empty, that is, Root does not have any subcomponents.
Print
Python Gui-tkinter Fonts: The first element as a tuple is the font family, the size of a point, optionally a string that contains one or more bold, italic, underlined style modifiers, bold.there can be up to three ways to specify a type style.Simple tuple font:As the first element of a tuple is the font family, the size of a point, you can choose a string that contains one or more bold, italic, underlined s
This article Reprinted from: http://blog.csdn.net/jcodeer/article/details/1811343
''Tkinter text (1 )''''''1. Create the first text '''From tkinter import *Root = TK ()T = text (Root)T. Pack ()Root. mainloop ()# Root contains a text control. You can enter text in the control. You can use Ctrl + C/V to add the content (text) on the clipboard to the text ), do not accept Ctrl + z operation'''2. add text to te
This article Reprinted from: http://blog.csdn.net/jcodeer/article/details/1811326
''' Tkinter message '''# Message is used to display text. Its usage is basically the same as that of label.'''1. Create a simple message '''From tkinter import *Root = TK ()Message (root, text = 'Hello message'). Pack ()Root. mainloop ()# Run the program. After you see hello, the message is displayed in the next line. This is
This article Reprinted from: http://blog.csdn.net/jcodeer/article/details/1811302
# Tkinter tutorial entry# Entry is used to input a single line of text.'''1. The first entry program '''From tkinter import *Root = TK ()Entry (root, text = 'input your text here '). Pack ()Root. mainloop ()# The above Code aims to create an entry object and display 'input your text here 'on the entry. Run this code and no tex
'''Tkinter event (1 )'''
# How to Use Events
'''1. Test the mouse click event '''
#-*-Coding: cp936 -*-
# # # # # From tkinter import *
Root = TK ()
Def printcoords (event ):
Print event. X, event. Y
# Create the first button and bind it to the left-click event
Bt1 = button (root, text = 'leftmost click ')
Bt1.bind ('
# Create two buttons and bind them to the key event
Bt2 = button (root, text = 'midddle ')
On some occasions, we need to visualize data. It is difficult to rely on tkinter alone, and the effect is not necessarily ideal.At this point, combining Tkinter with Matplotlib is the best choice.Knowledge Points:The whole routine of combining tkinter with matplotlib is fixed, just care about our drawing logic and program logicImportMatplotlibmatplotlib.use ('Tka
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.