Python tkinter.YES Examples
The following are 30
code examples of tkinter.YES().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
tkinter
, or try the search function
.

Example #1
Source File: show_progress.py From kiss with GNU General Public License v3.0 | 6 votes |
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()
Example #2
Source File: gui_mgr.py From plex-mpv-shim with MIT License | 6 votes |
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.
Example #3
Source File: streams.py From convis with GNU General Public License v3.0 | 6 votes |
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...")
Example #4
Source File: surface.py From License-Plate-Recognition with MIT License | 5 votes |
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()
Example #5
Source File: show_progress.py From stn-ocr with GNU General Public License v3.0 | 5 votes |
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)
Example #6
Source File: PlatformManagerDarwin.py From lackey with MIT License | 5 votes |
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()
Example #7
Source File: PlatformManagerWindows.py From lackey with MIT License | 5 votes |
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()
Example #8
Source File: view.py From inbac with MIT License | 5 votes |
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()
Example #9
Source File: show_progress.py From see with GNU General Public License v3.0 | 5 votes |
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)
Example #10
Source File: 8.13_3D_graphics.py From Tkinter-GUI-Application-Development-Blueprints-Second-Edition with MIT License | 5 votes |
def create_canvas(self): self.canvas = Canvas( self.root, width=400, height=400, background=self.bg_color) self.canvas.pack(fill=BOTH, expand=YES)
Example #11
Source File: 6.04.py From Tkinter-GUI-Application-Development-Blueprints-Second-Edition with MIT License | 5 votes |
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)
Example #12
Source File: 6.05.py From Tkinter-GUI-Application-Development-Blueprints-Second-Edition with MIT License | 5 votes |
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)
Example #13
Source File: 6.06.py From Tkinter-GUI-Application-Development-Blueprints-Second-Edition with MIT License | 5 votes |
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)
Example #14
Source File: 6.03.py From Tkinter-GUI-Application-Development-Blueprints-Second-Edition with MIT License | 5 votes |
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)
Example #15
Source File: 6.08.py From Tkinter-GUI-Application-Development-Blueprints-Second-Edition with MIT License | 5 votes |
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)
Example #16
Source File: 6.02.py From Tkinter-GUI-Application-Development-Blueprints-Second-Edition with MIT License | 5 votes |
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)
Example #17
Source File: 6.01.py From Tkinter-GUI-Application-Development-Blueprints-Second-Edition with MIT License | 5 votes |
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)
Example #18
Source File: 6.07.py From Tkinter-GUI-Application-Development-Blueprints-Second-Edition with MIT License | 5 votes |
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)
Example #19
Source File: TSP_GA_w.py From tsp with MIT License | 5 votes |
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")
Example #20
Source File: controller.py From Jacinle with MIT License | 5 votes |
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)
Example #21
Source File: gui.py From hdfm with GNU General Public License v3.0 | 5 votes |
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.
Example #22
Source File: window.py From moderngl-window with MIT License | 5 votes |
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()
Example #23
Source File: __init__.py From PyMsgBox with BSD 3-Clause "New" or "Revised" License | 5 votes |
def __put_buttons_in_buttonframe(choices): """Put the buttons in the buttons frame""" global __widgetTexts, __firstWidget, buttonsFrame __firstWidget = None __widgetTexts = {} i = 0 for buttonText in choices: tempButton = tk.Button(buttonsFrame, takefocus=1, text=buttonText) _bindArrows(tempButton) tempButton.pack( expand=tk.YES, side=tk.LEFT, padx="1m", pady="1m", ipadx="2m", ipady="1m" ) # remember the text associated with this widget __widgetTexts[tempButton] = buttonText # remember the first widget, so we can put the focus there if i == 0: __firstWidget = tempButton i = 1 # for the commandButton, bind activation events to the activation event handler commandButton = tempButton handler = __buttonEvent for selectionEvent in STANDARD_SELECTION_EVENTS: commandButton.bind("<%s>" % selectionEvent, handler) if CANCEL_TEXT in choices: commandButton.bind("<Escape>", __cancelButtonEvent)
Example #24
Source File: popup_win.py From equant with GNU General Public License v2.0 | 5 votes |
def _createTextWgt(self, frame): self.textWgt = tk.Text(frame, bg="black") self.textWgt.config(state="disabled", font=("Consolas", 16), fg="white") self.textWgt.pack(fill=tk.BOTH, expand=tk.YES)
Example #25
Source File: Oe2sSLE_GUI.py From Oe2sSLE with GNU General Public License v2.0 | 5 votes |
def __init__(self, parent, editor, *arg, **kwarg): super().__init__(parent, *arg, **kwarg) self.frameSlices = FrameSlices(self, editor) self.frameSlices.pack(fill=tk.BOTH, expand=tk.YES)
Example #26
Source File: Oe2sSLE_GUI.py From Oe2sSLE with GNU General Public License v2.0 | 5 votes |
def __init__(self, parent, *args, **kwargs): super().__init__(parent, *args, **kwargs) self.withdraw() self.transient(parent) self.protocol("WM_DELETE_WINDOW", self.on_delete) self.sliceEditor = SliceEditor(self) self.sliceEditor.pack(fill=tk.BOTH, expand=tk.YES) self.sliceEditor.update_idletasks() width, height = (self.sliceEditor.winfo_reqwidth(), self.sliceEditor.winfo_reqheight()) self.minsize(width, height) if self.system == 'Windows': def _on_mousewheel(event): self.sliceEditor.frame.canvas.yview_scroll(-1*(event.delta//120), "units") self.bind('<MouseWheel>', _on_mousewheel) elif self.system == 'Darwin': def _on_mousewheel(event): self.sliceEditor.frame.canvas.yview_scroll(-1*(event.delta), "units") self.bind('<MouseWheel>', _on_mousewheel) else: def _on_up(event): self.sliceEditor.frame.canvas.yview_scroll(-1, "units") def _on_down(event): self.sliceEditor.frame.canvas.yview_scroll(1, "units") self.bind('<Button-4>', _on_up) self.bind('<Button-5>', _on_down)
Example #27
Source File: app.py From subfinder with MIT License | 5 votes |
def __init__(self, master=None, cnf={}, **kw): super(Application, self).__init__(master, cnf, **kw) self.title = 'SubFinder' self.videofile = '' self._output = None # self.master.geometry('300x100') self.master.title(self.title) self.pack(fill=tk.BOTH, expand=tk.YES, padx=10, pady=10) self._create_widgets()
Example #28
Source File: review_filtered_clips.py From youtube-gesture-dataset with BSD 3-Clause "New" or "Revised" License | 5 votes |
def make_img_canvas(self): self.img_canvas = tk.Canvas(self.img_frame, bg='black') self.img_canvas.config(scrollregion=(0, 0, review_img_width, review_img_height)) hbar = tk.Scrollbar(self.img_frame, orient=tk.HORIZONTAL) hbar.pack(side=tk.BOTTOM, fill=tk.X) hbar.config(command=self.img_canvas.xview) vbar = tk.Scrollbar(self.img_frame, orient=tk.VERTICAL) vbar.pack(side=tk.RIGHT, fill=tk.Y) vbar.config(command=self.img_canvas.yview) self.img_canvas.bind("<MouseWheel>", self._on_mousewheel) self.img_canvas.config(xscrollcommand=hbar.set, yscrollcommand=vbar.set) self.img_canvas.pack(expand=tk.YES, fill=tk.BOTH)
Example #29
Source File: pyscreenshot.py From vrequest with MIT License | 4 votes |
def __init__(self, root, png): self.X = tkinter.IntVar(value=0) self.Y = tkinter.IntVar(value=0) sw = root.winfo_screenwidth() sh = root.winfo_screenheight() self.top = tkinter.Toplevel(root, width=sw, height=sh) self.top.overrideredirect(True) self.canvas = tkinter.Canvas(self.top, bg='white', width=sw, height=sh) self.image = tkinter.PhotoImage(file=png) self.canvas.create_image(sw//2, sh//2, image=self.image) self.fin_draw = None def btndown(event): self.X.set(event.x) self.Y.set(event.y) self.sel = True self.canvas.bind('<Button-1>', btndown) def btnmove(event): if not self.sel: return try: self.canvas.delete(self.fin_draw) except Exception as e: pass self.fin_draw = self.canvas.create_rectangle( self.X.get(), self.Y.get(), event.x, event.y, outline='red') self.canvas.bind('<B1-Motion>', btnmove) def btnup(event): self.sel = False try: self.canvas.delete(self.fin_draw) except Exception as e: pass left, right = sorted([self.X.get(), event.x]) top, bottom = sorted([self.Y.get(), event.y]) self.rect = (left, top, right, bottom) self.top.destroy() self.canvas.bind('<ButtonRelease-1>', btnup) self.canvas.pack(fill=tkinter.BOTH, expand=tkinter.YES)
Example #30
Source File: pypyzbar.py From vrequest with MIT License | 4 votes |
def __init__(self, root, png): self.X = tkinter.IntVar(value=0) self.Y = tkinter.IntVar(value=0) sw = root.winfo_screenwidth() sh = root.winfo_screenheight() self.top = tkinter.Toplevel(root, width=sw, height=sh) self.top.overrideredirect(True) self.canvas = tkinter.Canvas(self.top, bg='white', width=sw, height=sh) self.image = tkinter.PhotoImage(file=png) self.canvas.create_image(sw//2, sh//2, image=self.image) self.fin_draw = None def btndown(event): self.X.set(event.x) self.Y.set(event.y) self.sel = True self.canvas.bind('<Button-1>', btndown) def btnmove(event): if not self.sel: return try: self.canvas.delete(self.fin_draw) except Exception as e: pass self.fin_draw = self.canvas.create_rectangle( self.X.get(), self.Y.get(), event.x, event.y, outline='red') self.canvas.bind('<B1-Motion>', btnmove) def btnup(event): self.sel = False try: self.canvas.delete(self.fin_draw) except Exception as e: pass left, right = sorted([self.X.get(), event.x]) top, bottom = sorted([self.Y.get(), event.y]) self.rect = (left, top, right, bottom) self.top.destroy() self.canvas.bind('<ButtonRelease-1>', btnup) self.canvas.pack(fill=tkinter.BOTH, expand=tkinter.YES)