本文整理汇总了Python中tkinter.YES属性的典型用法代码示例。如果您正苦于以下问题:Python tkinter.YES属性的具体用法?Python tkinter.YES怎么用?Python tkinter.YES使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类tkinter
的用法示例。
在下文中一共展示了tkinter.YES属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import YES [as 别名]
def __init__(self, root):
self.root = root
self.frame = tkinter.Frame(root)
self.frame.pack(fill=tkinter.BOTH, expand=tkinter.YES)
self._image = None
self._sprite = None
self.canvas = tkinter.Canvas(
self.frame,
width=850,
height=400
)
self.canvas.pack(fill=tkinter.BOTH, expand=tkinter.YES)
self.queue = queue.Queue(maxsize=1)
self.periodic_image_update()
示例2: run
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import YES [as 别名]
def run(self):
root = tk.Tk()
self.root = root
root.title("Application Log")
text = tk.Text(root)
text.pack(side=tk.LEFT, fill=tk.BOTH, expand = tk.YES)
text.config(wrap=tk.WORD)
self.text = text
yscroll = tk.Scrollbar(command=text.yview)
text['yscrollcommand'] = yscroll.set
yscroll.pack(side=tk.RIGHT, fill=tk.Y)
text.config(state=tk.DISABLED)
self.update()
root.mainloop()
self.r_queue.put(("die", None))
# Q: OK. So you put Tkinter in it's own process.
# Now why is Pystray in another process too?!
# A: Because if I don't, MPV and GNOME Appindicator
# try to access the same resources and cause the
# entire application to segfault.
#
# I suppose this means I can put the Tkinter GUI back
# into the main process. This is true, but then the
# two need to be merged, which is non-trivial.
示例3: mainloop
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import YES [as 别名]
def mainloop(self):
try:
import Tkinter as tk
except ImportError:
import tkinter as tk
from PIL import Image, ImageTk
from ttk import Frame, Button, Style
import time
import socket
self.root = tk.Toplevel() #Tk()
self.root.title('Display')
self.image = Image.fromarray(np.zeros((200,200))).convert('RGB')
self.image1 = ImageTk.PhotoImage(self.image)
self.panel1 = tk.Label(self.root, image=self.image1)
self.display = self.image1
self.frame1 = Frame(self.root, height=50, width=50)
self.panel1.pack(side=tk.TOP, fill=tk.BOTH, expand=tk.YES)
self.root.after(100, self.advance_image)
self.root.after(100, self.update_image)
self.root.protocol("WM_DELETE_WINDOW", self.on_closing)
#global _started_tkinter_main_loop
#if not _started_tkinter_main_loop:
# _started_tkinter_main_loop = True
# print("Starting Tk main thread...")
示例4: __init__
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import YES [as 别名]
def __init__(self, win):
ttk.Frame.__init__(self, win)
frame_left = ttk.Frame(self)
frame_right1 = ttk.Frame(self)
frame_right2 = ttk.Frame(self)
win.title("车牌识别")
win.state("zoomed")
self.pack(fill=tk.BOTH, expand=tk.YES, padx="5", pady="5")
frame_left.pack(side=LEFT,expand=1,fill=BOTH)
frame_right1.pack(side=TOP,expand=1,fill=tk.Y)
frame_right2.pack(side=RIGHT,expand=0)
ttk.Label(frame_left, text='原图:').pack(anchor="nw")
ttk.Label(frame_right1, text='车牌位置:').grid(column=0, row=0, sticky=tk.W)
from_pic_ctl = ttk.Button(frame_right2, text="来自图片", width=20, command=self.from_pic)
from_vedio_ctl = ttk.Button(frame_right2, text="来自摄像头", width=20, command=self.from_vedio)
self.image_ctl = ttk.Label(frame_left)
self.image_ctl.pack(anchor="nw")
self.roi_ctl = ttk.Label(frame_right1)
self.roi_ctl.grid(column=0, row=1, sticky=tk.W)
ttk.Label(frame_right1, text='识别结果:').grid(column=0, row=2, sticky=tk.W)
self.r_ctl = ttk.Label(frame_right1, text="")
self.r_ctl.grid(column=0, row=3, sticky=tk.W)
self.color_ctl = ttk.Label(frame_right1, text="", width="20")
self.color_ctl.grid(column=0, row=4, sticky=tk.W)
from_vedio_ctl.pack(anchor="se", pady="5")
from_pic_ctl.pack(anchor="se", pady="5")
self.predictor = predict.CardPredictor()
self.predictor.train_svm()
示例5: __init__
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import YES [as 别名]
def __init__(self, root):
self.frame = tkinter.Frame(root)
self.frame.pack(fill=tkinter.BOTH, expand=tkinter.YES)
self._image = None
self._sprite = None
self.canvas = tkinter.Canvas(
self.frame,
width=850,
height=400
)
self.canvas.pack(fill=tkinter.BOTH, expand=tkinter.YES)
示例6: __init__
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import YES [as 别名]
def __init__(self, root, rect, frame_color, screen_cap, queue):
""" Accepts rect as (x,y,w,h) """
self.root = root
self.root.tk.call('tk', 'scaling', 0.5)
tk.Toplevel.__init__(self, self.root, bg="red", bd=0)
self.queue = queue
self.check_close_after = None
## Set toplevel geometry, remove borders, and push to the front
self.geometry("{2}x{3}+{0}+{1}".format(*rect))
self.overrideredirect(1)
self.attributes("-topmost", True)
## Create canvas and fill it with the provided image. Then draw rectangle outline
self.canvas = tk.Canvas(
self,
width=rect[2],
height=rect[3],
bd=0,
bg="blue",
highlightthickness=0)
self.tk_image = ImageTk.PhotoImage(Image.fromarray(screen_cap))
self.canvas.create_image(0, 0, image=self.tk_image, anchor=tk.NW)
self.canvas.create_rectangle(
2,
2,
rect[2]-2,
rect[3]-2,
outline=frame_color,
width=4)
self.canvas.pack(fill=tk.BOTH, expand=tk.YES)
## Lift to front if necessary and refresh.
self.lift()
self.update()
示例7: __init__
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import YES [as 别名]
def __init__(self, root, rect, frame_color, screen_cap):
""" Accepts rect as (x,y,w,h) """
self.root = root
tk.Toplevel.__init__(self, self.root, bg="red", bd=0)
## Set toplevel geometry, remove borders, and push to the front
self.geometry("{2}x{3}+{0}+{1}".format(*rect))
self.overrideredirect(1)
self.attributes("-topmost", True)
## Create canvas and fill it with the provided image. Then draw rectangle outline
self.canvas = tk.Canvas(
self,
width=rect[2],
height=rect[3],
bd=0,
bg="blue",
highlightthickness=0)
self.tk_image = ImageTk.PhotoImage(Image.fromarray(screen_cap[..., [2, 1, 0]]))
self.canvas.create_image(0, 0, image=self.tk_image, anchor=tk.NW)
self.canvas.create_rectangle(
2,
2,
rect[2]-2,
rect[3]-2,
outline=frame_color,
width=4)
self.canvas.pack(fill=tk.BOTH, expand=tk.YES)
## Lift to front if necessary and refresh.
self.lift()
self.update()
示例8: __init__
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import YES [as 别名]
def __init__(self, master: Tk, initial_window_size: Tuple[int, int]):
self.master: Tk = master
self.frame: Frame = tk.Frame(self.master, relief=tk.FLAT)
self.frame.pack(fill=tk.BOTH, expand=tk.YES)
self.image_canvas: Canvas = Canvas(self.frame, highlightthickness=0)
self.image_canvas.pack(fill=tk.BOTH, expand=tk.YES)
self.master.geometry(
str(initial_window_size[0]) + "x" + str(initial_window_size[1]))
self.master.update()
self.controller = None
self.bind_events()
self.create_menu()
示例9: create_canvas
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import YES [as 别名]
def create_canvas(self):
self.canvas = Canvas(
self.root, width=400, height=400, background=self.bg_color)
self.canvas.pack(fill=BOTH, expand=YES)
开发者ID:PacktPublishing,项目名称:Tkinter-GUI-Application-Development-Blueprints-Second-Edition,代码行数:6,代码来源:8.13_3D_graphics.py
示例10: create_drawing_canvas
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import YES [as 别名]
def create_drawing_canvas(self):
self.canvas_frame = tk.Frame(self.root, width=900, height=900)
self.canvas_frame.pack(side="right", expand="yes", fill="both")
self.canvas = tk.Canvas(self.canvas_frame, background="white",
width=500, height=500, scrollregion=(0, 0, 800, 800))
self.create_scroll_bar()
self.canvas.pack(side=tk.RIGHT, expand=tk.YES, fill=tk.BOTH)
开发者ID:PacktPublishing,项目名称:Tkinter-GUI-Application-Development-Blueprints-Second-Edition,代码行数:9,代码来源:6.04.py
示例11: create_drawing_canvas
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import YES [as 别名]
def create_drawing_canvas(self):
self.canvas_frame = tk.Frame(self.root, width=900, height=900)
self.canvas_frame.pack(side="right", expand="yes", fill="both")
self.canvas = tk.Canvas(self.canvas_frame, background="white",
width=500, height=500, scrollregion=(0, 0, 800, 800))
self.create_scroll_bar()
self.canvas.pack(side="right", expand=tk.YES, fill=tk.BOTH)
开发者ID:PacktPublishing,项目名称:Tkinter-GUI-Application-Development-Blueprints-Second-Edition,代码行数:9,代码来源:6.03.py
示例12: __init__
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import YES [as 别名]
def __init__(self, aRoot, aLifeCount = 100, aWidth = 560, aHeight = 330):
self.root = aRoot
self.lifeCount = aLifeCount
self.width = aWidth
self.height = aHeight
self.canvas = Tkinter.Canvas(
self.root,
width = self.width,
height = self.height,
)
self.canvas.pack(expand = Tkinter.YES, fill = Tkinter.BOTH)
self.bindEvents()
self.initCitys()
self.new()
self.title("TSP")
示例13: __create_tk
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import YES [as 别名]
def __create_tk(self):
self.tk_root = tk.Tk()
self.tk_root.title(self.__title)
self.__update_image()
self.tk_canv = tk.Label(self.tk_root, image=self.tk_image, bd=0)
self.tk_canv.pack(side=tk.TOP, expand=tk.YES, fill=tk.BOTH)
self.tk_canv.focus_set()
self.tk_canv.bind("<KeyPress>", self.__press)
self.tk_canv.bind("<KeyRelease>", self.__release)
示例14: __init__
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import YES [as 别名]
def __init__(self, title, dim, delete_eh):
"""
:param title: title of the window
:param dim: window default image dimensions
"""
# Init display object.
self.init()
# Image that will be displayed on this window.
self.image = None
self.image_cpy = None
self.p_image = None
# Init image to a blank image.
new_img = self.blank_image(dim)
self.image = new_img
self.set_image(new_img)
# Set up display.
self.title(title)
# Set up image display panel.
self.panel = tkinter.Label(self)
self.panel.pack(fill=tkinter.BOTH, expand=tkinter.YES)
self.update_image()
# Register window delete event handler.
self.protocol('WM_DELETE_WINDOW', delete_eh)
# Difference in window and image dims.
self.diff_dim_w = None
self.diff_dim_h = None
self.update()
self.get_diff_dim()
# Resize event handler.
self.panel.bind('<Configure>', self.resize_image)
# Resize if window is too big for the screen.
self.screen_resize()
# A callback function to check for and make updates.
self.after('2000', self.update_window)
# Determines what tkinter display is inherited.
示例15: __init__
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import YES [as 别名]
def __init__(self, **kwargs):
super().__init__(**kwargs)
self._tk = tkinter.Tk()
self._gl_widget = ModernglTkWindow(self._tk, width=self.width, height=self.height)
self._gl_widget.pack(fill=tkinter.BOTH, expand=tkinter.YES)
self._tk.resizable(self._resizable, self._resizable)
if self._fullscreen:
self._tk.attributes('-fullscreen', True)
self.cursor = self._cursor
# Set up events
self._gl_widget.bind('<Configure>', self.tk_resize)
self._tk.bind('<KeyPress>', self.tk_key_press)
self._tk.bind('<KeyRelease>', self.tk_key_release)
self._tk.bind('<Motion>', self.tk_mouse_motion)
self._tk.bind('<Button>', self.tk_mouse_button_press)
self._tk.bind('<ButtonRelease>', self.tk_mouse_button_release)
self._tk.bind('<MouseWheel>', self.tk_mouse_wheel)
self._tk.bind('<Map>', self.tk_map)
self._tk.bind('<Unmap>', self.tk_unmap)
self._tk.protocol("WM_DELETE_WINDOW", self.tk_close_window)
self.title = self._title
# Ensure the window is opened/visible
self._tk.update()
self._gl_widget.tkMakeCurrent()
self.init_mgl_context()
self.set_default_viewport()