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, a
The first step: first look at whether there is a tkinter module in Python, that is, find _tkinter.so, the following command:
sudo find/-name "*tkinter.so"
Step Two: If you can find the Tkinter module in Python and see the version information for _tkinter.so, use the following command:
Sudo Find/-name "libtk*"
My sy
Tkinter is the standard GUI library in the python release version. That is to say, tkinter can be used after python is installed by default.
I have referenced a tutorial and wrote someCodeTry:
# File: test. pyfrom tkinter import * class app: def _ init _ (self, Master):
= testping). Pack () Test.mainloop ()Created window programs such asIf the feeling size is inappropriate, you can use, such as Test.geometry (' X-ray ') to set the window to the size of the pixel, remember that × is the letter is not a symbol, window parameters here not much to sayNow let's see if clicking on the Network Monitor button does the required functionality.So, in a graphical interface to implement the ping command is done, is it simple?In fact, a good function is not only necessary,
Share an introductory example of Python Tkinter base control usage, including window display, display of built-in images, popup windows, menus, and more.Example, Python tkinter the use of the underlying control#-*-coding:utf-8-*- fromTkinterImport*defBtn_click (): b2['text'] ='clicked'Evalue=E.get ()Print 'btn Click an
For the use of the listbox for the Python Tkinter component, see the following code for a demonstration:1 fromTkinterImport*2 3root=Tk ()4v=Stringvar ()5 #ListBox and variable binding '6Lb1=listbox (root,listvariable=v)7V.set (('Ten',' -',' -',' +',' -'))8 Print(V.get ())9 Lb1.pack ()Ten One #. Create a ListBox with multiple selections, using the attribute selectmaod ' ALb2=listbox (root,selectmode=multip
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
Run
An accidental opportunity for me to come into contact with the Python language, personally feeling that Python is a powerful tool language. Make up your mind to study it well. Talk less, tell the next demo of the implementation process and source code. Thank you for correcting me!The first step: the Main toolkit is: Smtplib. Here is the core code for the basic operation:Step two: Implement the UI with
Python tkinter event advanced usage instance, pythontkinter
This example describes the advanced usage of Python tkinter events. We will share this with you for your reference. The details are as follows:
Let's take a look at the running effect:
Complete instance code:
# -*- coding:utf-8-*-#! python3from
Python+opencv+tkinter Integrated Demo
Because of the need to use OPENCV for small demo development, but because the OPENCV with the GUI function is still very simple, so use opencvv+tkinter combination implementation.
First, the result chart.
In the GUI click on the point of Praise button in the console can show "Someone to give you a little praise."
Directly o
Python Tkinter implements the simple calculator function, pythontkinter
In my spare time, I wrote a simple calculator using tkinter to implement simple addition, subtraction, multiplication, division operations. I used two buttons and entrycontrols. below is the code, but I simply used the partial function partial, because most of the parameters of multiple butto
Python tkinter for simple login Registration final effect
Start interface
?
Registered
Landing
?
SOURCE login.py# Encoding=utf-8 fromTkinterImport * fromTkinterImportMessageBox asTkmessageboxImportMysql_connect asMysImportPymysqlImportBase64#加密 The user's password is encrypted and stored in the databasedefEnc
This example shows a simple chat window for Python's tkinter layout. Share for everyone to use for reference. The specific methods are as follows:
This example shows a simple chat window, can be implemented below the input chat content, click Send, can be added to the top of the chat record list. Now it's just a "stand-alone" version.There is an empty space on the right to put something else on. Interested readers can further make the socket to chat
Basic operationsImportTkinter as TK#introduction of TK packageWin=tk. Tk ()#Introducing Window ObjectsWin.title ("Window Title")#Window TitleWin.geometry ("200x100")#window width x HeightWin.geometry ("+500+200")#window to the top left of the screenlable=tk. Label (Win,#Parent Window Objecttext='omg! This is tk!',#the text of the labelbg='Green',#Background ColorFont= ('Arial', 12),#font and font sizeWidth=15, height=2#Label Length width )" "label or other label settings style can be in strin
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 smal
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 cha
This article mainly introduces the color space Conversion Program Based on Tkinter using python. If you are interested, refer to this article based on colorsys, for example, converting from hls to rgb, if you want to change the color space, you can easily modify a function. The specific content is as follows:
UsedScale and Canvas Components.
Run:
The Code is as follows:
From
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
The main window under Python can be defined as follows:def start (self):#self. Project = Project ("temp")#self. Project.directory = OS.GETCWD ()#Splash = SplashScreen (self.master)Self.hellos = 0Self.master.title ("Stars:space-time Analysis of Regional Systems")Self.master.iconname ("STARS")Self.master.bind ("h = self.winfo_screenheight ()W = self.winfo_screenwidth ()Geom = "%dx%d"% (w,h)Self.master.geometry ("600x400+0+0")The menu is defined as follo
This example demonstrates the use of the Python Tkinter base control and is shared for your reference. The specific method is as follows:
#-*-Coding:utf-8-*-from tkinter import * def btn_click (): b2[' text '] = ' clicked ' Evalue = E.get () print ' btn Click and Entry value is%s '% Evalue def btn_click_bind (event): print ' Enter B2 ' Def show_toplevel ():
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.