Excerpt from Python core programmingIn this section we will show an example of an intermediate Tkinter application, which is a tree traversal tool: It starts with the current directory, provides a list of files, and double-clicks any other directory in the list, allowing the tool to switch to the new directory and replace the old file list with the list of files in the new directory. A list box, text box, and scroll bar are added here, as well as call
In peacetime development process often encounter needs to simulate post or get request, of course get generally directly through the browser can also be convenient and quick. Zhengxiao See the Internet also has a lot of software version of the HTTP simulator, the function is also very powerful. Zhengxiao recently in learning python, just hand idle panic, with Python with the Tkinter Library wrote an HTTP simulation tool, the function is relatively sim
I. Installation of Tkinterin Linux, Python defaults to not installing the Tkinter module,
Copy Code code as follows:
[root@li250-193 ~]# python
Python 2.6.6 (r266:84292, Feb 22 2013, 00:00:18)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-3)] on linux2
Type ' help ', ' copyright ', ' credits ' or ' license ' for the more information.
>>> Import Tkinter
Traceback (most recent call last):
File
The example in this paper describes how Python implements a simple text editor based on the Tkinter library. Share to everyone for your reference. The implementation method is as follows:
# # {{http://code.activestate.com/recipes/578568/(r1) from Tkinter Import * from Tksimpledialog import Askstringfrom TkF Iledialog Import asksaveasfilenamefrom tkmessagebox Import Askokcancel class Quitter (
Python tkinter implements the method of moving graphics with the mouse, pythontkinter
This article describes how to move a graph with the mouse using tkinter developed in python. We will share this with you for your reference. The details are as follows:
This is inspired by a js effect:
Two eyes move with the mouse
Running effect:
Code Section:
From tkinter impo
"Content two" Text.insert (END, ' content three ') #在文本框末尾插入 "content three"Delete (index), delete (from, to)Delete the value of the direct position in the text box#示例text. Delete #删除索引值为10的值text. Delete #删除索引值从10到20之前的值text. Insert (0, END) #删除所有值ICursor (Index)Moves the cursor to the specified index position only when the frame gets the focus#示例text. ICursor (#移动光标到索引为10的位置) Get ()Gets the value of the file box#示例text. Get () #返回文本框的值Index (I
This article Reprinted from: http://blog.csdn.net/jcodeer/article/details/1811293
# Tkinter tutorial label''' 1. The first example of labelText attribute usage'''# To use the TK module, unless you do not want to use this module, you do not need to read the entire tutorial.From tkinter import *# Initialize TKRoot = TK ()# Create a label and use the encoding. Up to now, no ide has been used directly through "
One, install Tkinter in Linux, Python does not install the Tkinter module by default, and the Copy code code is as follows: [[emailprotected] ~]# python python 2.6.6 (r266:84292, Feb, 00:00:18) [GCC 4.4.7 20120313 (Red Hat 4.4.7-3)] on linux2 Type ' help ', ' copyright ' , "credits" or "license" for more information. >>> Import Tkinter Traceback (most rec
Code#Tkinter Base Add a button, display text on the button, and set the text colorImportTkinter as TK#Object-Oriented programmingclassApp ():def __init__(self, Master): Frame= Tk. Frame (Master)#frame?? I don't understand .Frame.pack ()#Create a button, FG foreground color: BlueSelf.testbutton = Tk. Button (
= ' Happy birthday ", font= (" couried ",") "Nine, display picturesTo display a picture on the canvas with Tkinter, first load the picture, and then use the create_image function on the canvas object.This is a picture of my existence on the E disk:We can show one.gif pictures like this: from import*>>> tk = tk ()>>> canvas = canvas (tk,width=400,height=400)> >> canvas.pack ()>>> my_image = photoimage (file='e:\\ffoutput\\one.gif ' )>>> canvas.c
Python + tkinter simulate "remember me" to automatically log on to the instance code, pythontkinter
The Code shared in this article is mainly used to simulate the "remember me" Automatic Logon function through Python + tkinter. The details are as follows.
Basic Idea: If a logon succeeds, a temporary file is created to record the relevant information. Each time the program is started, the system tries to aut
Use the tkinter module in Python to plot (continued), pythontkinter8. display text
UseCreate_textWrite on the canvas. This function only requires two coordinates (The position of the text x and y) and a named parameter to accept the text to be displayed. For example:
>>> from tkinter import*>>> tk = Tk()>>> canvas = Canvas(tk,width=400,height=400)>>> canvas.pack()>>> canvas.create_text(150,100,text='Happy b
introduction of Tkinter and a simple tutorial
Tkinter is a standard GUI library for Python. Python uses Tkinter to quickly create GUI applications.Because Tkinter is built into the Python installation package, as long as the installation of Python can import Tkinter library
First, Tkinter Introduction
Tkinter is a Python module that is an interface to call TCL/TK, a Cross-platform scripting interface. Tkinter is not the only Python graphics programming interface, but it is one of the more popular. The biggest feature is Cross-platform, the disadvantage is that performance is not good, execution speed is slow.The general way to use
This example shows a simple chat window for a Python tkinter layout. Share it for everyone's reference. Here's how:
This example shows a simple chat window, can be implemented below the input chat content, click Send, can be added to the above chat record list. Now it's just a "stand-alone" version.There is a vacancy on the right to put something else. Interested readers can further make the sockets to chat with each other.
Here is the function code
Use the Tkinter module to create a simple GUI program.
Tkinter's widgets are: Button, Canvas, Checkbutton, Entry, Frame, Label, Listbox, Menu, Menubutton, Message, Radiobutton, Scales, Scrollbar, TEXT, TopLevel and so on.
Cases:
The code is as follows:
# This program displays an empty window.Import Tkinterdef main ():Main_window = tkinter.tk ()Tkinter.mainloop ()Main ()
Example 2:
The code is as follows:
Town Field Poem:The Pure Heart sentiment wisdom language, does not have the world name and the benefit. Learn water under the hundred rivers, give up arrogant slow meaning.Learn to have a small return to feed root, willing to cast a conscience blog. Sincere in this writing experience, willing to see the text to inspire.——————————————————————————————————————————CodeImport Tkinter as tk# object-oriented programming idea Class APP: def __init__ (self,
Use this little game to learn how to use the Tkinter in ython3.3
Copy Code code as follows:
#-*-Coding:utf-8-*-
Import Tkinter as TK
Import Sys
Import Random
Import re
Number = Random.randint (0,1024)running = Truenum = 0NMAXN = 1024Nminn = 0
def ebtnclose (event):Root.destroy ()def ebtnguess (event):Global NMAXNGlobal NminnGlobal numGlobal Running#修改缺陷: User is correct, prompt tag also
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
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.