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
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
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 *
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
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
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-
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
:
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
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
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
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.