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 system is loaded with 8.5.
Then modify the setup.dist and use the following command:
Vim Mod
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 on the code:
fromTkinterImport*ImportCv2 fr
>>> 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 arguments. can also raise it to a position in the s
# XXX to do:#-Popup menu#-Support partial or total redisplay#-Key bindings (instead of quick-n-dirty bindings on canvas ):#-Up/down arrow keys to move focus around#-Ditto for page up/down, home/end#-Left/right arrows to expand/Collapse move out/in#-More Doc strings#-Add icons for "file", "module", "class", "method"; better "Python" icon#-Callback for selection ???#-Multiple-item selection#-Tooltips#-Redo geometry without magic numbers#-Keep track of object IDs to allow more careful cleaning#-Op
This example describes a Python-based tkinter implementation of Notepad. Share to everyone for your reference. Specific as follows:
From Tkinter Import *root = Tk ("Simple Editor") Mi=stringvar () Label (text= ' Please input something you like~ '). Pack () Te = Te XT (height = 30,width =100) te.pack () Label (text= ' File name '). Pack (side = left) Entry (textvariable = mi). Pack ( Side = left
_ Tkinter. TclError: no display name and no $ DISPLAY environment variable, displayvariable
_ Tkinter. TclError: no display name and no $ DISPLAY environment variable
This is a problem that occurs when you use the pluginx inx of the cocos2d-x. In a win32 environment, run gameDevGuide. sh with cygwin, and this prompt appears.
The solution is relatively simple. In the cygwin directory, delete the python-
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 (Frame): Def __
', Wraplength=50,width=30,height=10, BG='Blue', fg='Red', anchor='NW') (4) Bitmap Description: Displays the built-in bitmap. If the image option is specified, this option is ignored. The following bitmaps are valid on all platforms: Error, gray75, gray50, gray25, Gray12, Hourglass, info, questhead,question, and warning. Label=tkinter.label (root,bitmap='Error') (5) FG BG Description: Set foreground and background colors label=tkinter.label (root,text='helloworld!', fg='Red', bg='Blue') (A). Use
Tkinter supports three kinds of geometry managers: Grid Manager, Package Manager, location ManagerTip: Because each manager has its own style of placing widgets, it is best not to use multiple managers in small artifacts in the same container. You can use the framework as a sub-container to get the desired layout.1. Grid Manager#Geometry Manager (1)-----grid Manager" "The grid manager places the widget in each cell that is not visible to the grid. You
#!/usr/bin/python#-*-coding:utf-8-*-if __name__=='__main__': fromTkinterImport*Root= Tk ()#Tk () is a function in the Tkinter library.Root.title ('What the hell?') Canvas=Canvas (root, Width= 400,#width of canvasHeight = 400,#the height of the canvasBG ='Red' #Beijing color of canvas) X0= 20y0= 20Y1= 275X1= 275#RectangleCanvas.create_rectangle (X0,y0,x1,y1,fill ='Yellow')#Rectangle Two coordinate point (x0,y0) (x1,y1) starting and ending point o
Python Tkinter simple layout Learning
#-*-Coding: UTF-8-*-from Tkinter import * root = Tk () #80x80 indicates the size of the main window during initialization, and indicates the location of the window during initialization as root. geometry ('80x80 + 10 + 10') # Fill direction ''' Label (root, text = 'l1', bg = 'red '). pack (fill = Y) Label (root, text = 'l2', bg = 'green '). pack (fill = BOTH) Label (roo
Tkinter supports three kinds of geometry managers: Grid Manager, Package Manager, location ManagerTip: Because each manager has its own style of placing widgets, it is best not to use multiple managers in small artifacts in the same container. You can use the framework as a sub-container to get the desired layout.1. Grid Manager#Geometry Manager (1)-----grid Manager" "The grid manager places the widget in each cell that is not visible to the grid. You
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
Beginner python tkinter, use the current learning to write a simple calculator to practice.Expected effect:1. Ability to implement subtraction operations,2. Only numbers can be entered3. Choose which operation to perform with the button.4. Result box cannot be modified, smart copy5. Press the Clear button to clear all contentFROMNBSP;NBSP;TKINTERNBSP;IMPORTNBSP;*COUNTNBSP;=NBSP;TK () count.title ("Pure mash eight cup @ calculator") defclear (): v1.set
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
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 (frame, Text ="Hello", FG ="Blue") self.testButton.pack () root=tk. Tk () app=App (Root) root.mainloop ()Results: Python
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.