tkinter

Discover tkinter, include the articles, news, trends, analysis and practical advice about tkinter on alibabacloud.com

Python3 uses Tkinter to implement a simple instance of the UI interface _python

Copy Code code as follows: Import time Import Tkinter as TK Class Window: def __init__ (self, title= ' NMS ', width=300, height=120, Stafunc=bool, Stofunc=bool): SELF.W = width self.h = height Self.stat = True Self.stafunc = Stafunc Self.stofunc = Stofunc Self.staico = None Self.stoico = None Self.root = Tk. Tk (Classname=title) Def Center (self): WS = Self.root.winfo_screenwidth () HS = Self.root.winfo_screenheight () x = In

Use of Tkinter in Python (appropriate event collation) (ii)

1, fonts (font) General format: (' Times-10 bold ') (' Times ', ten, ' bold ', ' italic ') in turn, indicate font, font size, bold, italic 2, the use of pictures (image) Photo=photoimage (file= ' path.gif ') Canvas = Canvas.create_image (Image=photo) Tkinter only supports a few other formats, such as GIF and BMP, you want to insert other format pictures you need to import Pil;pip install a Third-party class library pillow From PIL import image,imagetk

Tkinter realizes stopwatch function

#-*-coding:utf-8-*-' Created on November 25, 2015 @author: Zroad ' "from tkinter Import * Import time class stopwatch (Fra Me): "" To implement a stopwatch widget "" "msec = def __init__ (self,parent = none,**kw): frame.__init__ (SELF,PARENT,KW) Self._start = 0.0 Self._elapsedtime = 0.0 self._running = False self.timestr = Stringvar () Self.makewidgets () def makewidgets (self): "" "Production Time label" "L = label (self,textvariable

Notepad development---The use of tkinter

#coding: Utf-8 __author__ = ' xshengjing ' from Tkinter Import * from tkmessagebox Import * from tkfiledialog import * impor t os file_name = "Def search (): Top_search = toplevel (Root) #top_search. Geometry (" 300*30+20+250 ") label_01 = Label (top_search,text= "Find") Label_01.grid (row=0,column=0,padx=5) entry_01 = entry (top_search,width=20) ENT Ry_01.grid (row=0,column=1,padx=5) button_01 = button (top_search,text= "Find") Button_01.grid (row=0,

Python Tkinter Canvas Oval principle

would be stippled. Default is stipple= "", which means a solid color. A typical value would be stipple= "gray25". has no effect unless the fill have been set to some color. See section 4.7, "Bitmaps". Tags The tags to is associated with the object, as a sequence of strings. See section 6.1.4, "Canvas tags". Width The Width of the border around the outside of the ellipse. Default is 1 pixel; See sections 4.1, "Dimensions" for possible values. If you s

Python implementation of color space conversion program (Tkinter)

This paper is mainly based on colorsys implementation, the sample is from HLS to RGB, if you want to change the color space is very easy to modify only a function, the specific content is as follows Scale and canvas components are used. Run: The code is as follows: from Tkinter import * Import Colorsys #操作后的响应函数 def update (* args): ' color ' r,g,b = Colorsys.hl S_to_rgb (H.get ()/255.0, L.get ()/255.0, S.get ()/255.0) R,g,b = R * 255, G * 255, B *

Python development _ tkinter

The module ("Tk interface") isInterface of the standard Tk GUI toolkit. Tk andIt can be used on most Unix platforms, It can also be applied in Windows and Macintosh systems. Later versions of Tk8.0 can implement local window styles and run well on most platforms. Is a Python module with Tk interfaces,Library provides interfaces for Tk APIs, It belongs to the GUI tool group of Tcl/Tk. Tcl/Tk is a writing and graphics device developed by John Ousterhout. Tcl (tool command language) is a macro

Python developer _ tkinter _ move the image with the mouse

This is inspired by a js effect: Two eyes move with the mouse tkinter * = { : : : : : self.draw = Canvas(self, width=500, height=500 self.mouse_x = 450 self.mouse_y = 250 self.oval_zero_x = 250 self.oval_zero_y = 250 self.oval_r = 100 self.oval_

Solution for Tkinter Interface card

a thread" " #Createt = Threading. Thread (Target=func, args=args)#Guardian!!!T.setdaemon (True)#StartT.start ()#blocking--The card-dead interface! #T.join ()Root=tk. Tk () Text=tk. Text (Root) text.pack () Tk. Button (root, Text='Music', command=Lambda: Thread_it (music, songs)). Pack () Tk. Button (root, Text='movie', command=Lambda: Thread_it (movie, movies, Text)). Pack () Root.mainloop ()Way two, inherit threading. Thread classImportTkinter as TKImport TimeImportthreadingsongs= ['Lov

Tkinter Event Advanced Usage Example

='rectangles') defMoveinsquares (self, Tag):#5 reps of 4 times per sec forIinchRange (5): for(DIFFX, Diffy)inch[(+20, 0), (0, +20), (-20, 0), (0,-20))]: Self.canvas.move (tag, DIFFX, Diffy) self.canvas.update ()#Force screen Redraw/updateTime.sleep (0.25)#pause, but don ' t block GUIclassCanvaseventsdemothread (canvaseventsdemotags):defMoveem (self, tag): forIinchRange (5): for(DIFFX, Diffy)inch[(+20, 0), (0, +20), (-20, 0), (0,-20))]: Self.canvas.move

Tkinter notes Four

,charsWidget.pack (Expand=yes, fill=BOTH) Widget.bind ('', Onleftclick)#mouse button clicksWidget.bind ('', Onrightclick) Widget.bind ('', Onmiddleclick)#Middle=both on some miceWidget.bind ('', Ondoubleleftclick)#Click Left twiceWidget.bind ('', Onleftdrag)#Click Left and moveWidget.bind ('', onKeyPress)#All keyboard PressesWidget.bind ('', Onarrowkey)#arrow Button pressedWidget.bind ('', Onreturnkey)#return/enter Key pressedWidget.focus ()#or bind keypress to TkrootTkroot.title ('Click Me') Tk

Python3 uses tkinter to split the window (splitwindow)

From tkinter import *From idlelib. tabbedpages import * Class mainframe (FRAME ):Def _ init _ (self, Master = none, CNF = {}, ** kW ):Self. Master = MasterSuper (mainframe, self). _ init _ (self. Master, CNF)# Create a menuSelf. mmenu = menu (Root)Self. master. config (menu = self. mmenu) Self. master. rowconfigure (0, Weight = 1)Self. master. columnconfigure (0, Weight = 1)Self. Grid (sticky = W + E + N + S) Self. bottomlabel = label (self. Master, t

Tkfiledialog-tkinter Wiki

are installed. -Mustexist Boolean Specifies whether the user may specify non-existent directories. If this parameter is true, then the user may only select directories that already exist. The default value is false. -Parent window Makes window the logical parent of the dialog. The dialog is displayed on top of its parent window. -Title titlestring Specifies a string to display as the title of the dialog box. If this option is not specified, then a default title will be displayed. [Sou

python-Module-tkinter

Event:1 def evclear (): 2 lhistory['text'] = ehello.get ()3 ehello.delete (0, Tk. END)DescriptionThe text within the lhistory tag becomes the content of the Ehello input area, and then the text of the Ehello area is deleted.You can set the label text using a dictionary-style access method.Delete () uses 0 as the first argument, the description text begins, and the second parameter Tk. END. Represents a special value that represents the end of the text.python-Module-

Python Tkinter full Screen display

1 #!/usr/bin/env python2 #-*-coding:utf-8-*-3 4 ImportTkinter as TK5 6 classFullscreenapp (object):7 def __init__(Self, master, * *Kwargs):8Self.root =Master9 #self.tk.attributes ('-zoomed ', True) # This just maximizes it so we can see the window. It 's nothing-to-do with fullscreen.TenSelf.frame =tk. Frame (self.root) One Self.frame.pack () ASelf.state =False -Self.root.bind ("", Self.toggle_fullscreen) -Self.root.bind ("", Self.end_fullscreen) the - defToggle_fullscreen (Self

Python's tkinter Use-message bullet box

= Messagebox.askretrycancel ('message Box','Askretrycancel') * Print('Askretrycancel:', R) $Str_var.set ('ShowError')Panax Notoginseng elifn = = 5: -R = Messagebox.showerror ('message Box','ShowError') the Print('ShowError:', R) +Str_var.set ('Showinfo') A elifn = = 6: theR = Messagebox.showinfo ('message Box','Showinfo') + Print('Showinfo:', R) -Str_var.set ('showwarning') $ Else: $R = messagebox.showwarning ('message Box','showwarning') - Print('sho

Python:gui's Tkinter Learning Note 2 interface layout display

(fill=X)#x, y#entry.place (x=0,y=0)#relx,rely#entry.place (relx=0.3, rely=0.3)#entry.place (relx=0.5, rely=0.5)#Relheight,relwidth#entry.place (relx=0.5, rely=0.5,relheight=0.5,relwidth=0.5)#_forget:ImportTime,threadinglabel2=label (text="Warning! ", bg='Blue') Label2.place (Relx=0.2,rely=0.2)defrun (): Start_time=time.time () whileTrue:ifTime.time ()-start_time>3: Label2.place_forget () BreakT=threading. Thread (target=run) T.setdaemon (True) T.start () Root.mainloop ()To learn more, refer to

Python diary--using Tkinter to learn GUI design

: Dimension Control size; Color Control color; Font control font; Anchor Anchor Point; Relief control style; Bitmap Bitmap Cursor Cursor Write a simple form program yourself.ImportTkinter as TK fromTkinterImportMessageBoxclassapp:def __init__(self,root): Frame=tk. Frame (Root) frame.pack () Self.hi_there=tk. Button (frame,text="Greeting", fg="Blu

Python_ the Tkinter frame with a scroll bar __python

Problem background: When the interface needs to display more content, need to use scroll bar ScrollBar, Official document said ScrollBar can only with the following controls (canvas, entry, ListBox, text) combined. But if I want ScrollBar to be

Tkinter of Python GUI development

TK InterFirst window from Import *Tk (). Mainloop ()The current thread calls Mainloop () and changes into the event loop, and the code behind is blocked.If you want to create multiple windows from Import *fromimport * for in range (5): Thread

Total Pages: 15 1 .... 11 12 13 14 15 Go to: Go

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.