Python Tkinter.Y Examples
The following are 13
code examples of Tkinter.Y().
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: SikuliGui.py From lackey with MIT License | 6 votes |
def __init__(self, master, textvariable=None, *args, **kwargs): tk.Frame.__init__(self, master) # Init GUI self._y_scrollbar = tk.Scrollbar(self, orient=tk.VERTICAL) self._text_widget = tk.Text(self, yscrollcommand=self._y_scrollbar.set, *args, **kwargs) self._text_widget.pack(side=tk.LEFT, fill=tk.BOTH, expand=1) self._y_scrollbar.config(command=self._text_widget.yview) self._y_scrollbar.pack(side=tk.RIGHT, fill=tk.Y) if textvariable is not None: if not isinstance(textvariable, tk.Variable): raise TypeError("tkinter.Variable type expected, {} given.".format( type(textvariable))) self._text_variable = textvariable self.var_modified() self._text_trace = self._text_widget.bind('<<Modified>>', self.text_modified) self._var_trace = textvariable.trace("w", self.var_modified)
Example #2
Source File: closable_Tab_with_menu.py From PCWG with MIT License | 6 votes |
def __init__(self, parent): scrollbar = tk.Scrollbar(parent, orient=tk.VERTICAL) self.listbox = tk.Listbox(parent, yscrollcommand=scrollbar.set, selectmode=tk.EXTENDED) scrollbar.configure(command=self.listbox.yview) self.listbox.pack(side=tk.LEFT,fill=tk.BOTH, expand=1, pady=5) scrollbar.pack(side=tk.RIGHT, fill=tk.Y, pady=5)
Example #3
Source File: cs1media.py From cs101 with GNU General Public License v3.0 | 6 votes |
def canvClick(self, event): try: x = int(self.canvas1.canvasx(event.x) / self.root.zoomMult) y = int(self.canvas1.canvasy(event.y) / self.root.zoomMult) w, h = self.root.im.size if 0 <= x < w and 0 <= y < h: tk_rgb = "#%02x%02x%02x" % self.root.im.getpixel((x, y)) self.canvas2.config(bg=tk_rgb) rgb = "R: %d; G: %d; B: %d;" % self.root.im.getpixel((x, y)) self.v.set(rgb) xy = "X: %d; Y: %d;" % (x, y) self.xy.set(xy) else: rgb = "X,Y Out of Range" self.v.set(rgb) except ValueError: pass
Example #4
Source File: menotexport-gui.py From Menotexport with GNU General Public License v3.0 | 6 votes |
def addMessageFrame(self): frame=Frame(self) frame.pack(fill=tk.BOTH,side=tk.TOP,\ expand=1,padx=8,pady=5) self.messagelabel=tk.Label(frame,text='Message',bg='#bbb') self.messagelabel.pack(side=tk.TOP,fill=tk.X) self.text=tk.Text(frame) self.text.pack(side=tk.TOP,fill=tk.BOTH,expand=1) self.text.height=10 scrollbar=tk.Scrollbar(self.text) scrollbar.pack(side=tk.RIGHT,fill=tk.Y) self.text.config(yscrollcommand=scrollbar.set) scrollbar.config(command=self.text.yview)
Example #5
Source File: viewer.py From networkx_viewer with GNU General Public License v3.0 | 5 votes |
def __init__(self, parent, property_dict, *args, **kw): tk.Frame.__init__(self, parent, *args, **kw) # create a canvas object and a vertical scrollbar for scrolling it self.vscrollbar = vscrollbar = tk.Scrollbar(self, orient=tk.VERTICAL) vscrollbar.pack(fill=tk.Y, side=tk.RIGHT, expand=tk.FALSE) self.canvas = canvas = tk.Canvas(self, bd=0, highlightthickness=0, yscrollcommand=vscrollbar.set) canvas.pack(side=tk.LEFT, fill=tk.BOTH, expand=tk.TRUE) vscrollbar.config(command=canvas.yview) # reset the view canvas.xview_moveto(0) canvas.yview_moveto(0) # create a frame inside the canvas which will be scrolled with it self.interior = interior = tk.Frame(canvas) self.interior_id = canvas.create_window(0, 0, window=interior, anchor='nw') self.interior.bind('<Configure>', self._configure_interior) self.canvas.bind('<Configure>', self._configure_canvas) self.build(property_dict)
Example #6
Source File: components.py From SEM with MIT License | 5 votes |
def pack(self): self.file_selector_button.pack(**self.button_opt) self.label.pack() self.scrollbar.pack(side=tkinter.RIGHT, fill=tkinter.Y) self.selected_files.pack(fill=tkinter.BOTH, expand=True)
Example #7
Source File: components.py From SEM with MIT License | 5 votes |
def grid(self, row=0, column=0): """ TODO: to be tested """ x = row y = column self.file_selector_button.grid(row=x, column=y, **self.button_opt) x += 1 self.label.grid(row=x, column=y) x += 1 self.scrollbar.pack(side=tkinter.RIGHT, fill=tkinter.Y) self.selected_files.grid(row=x, column=y, fill=tkinter.BOTH, expand=True) x += 1 return (x,y)
Example #8
Source File: pcwg_tool_reborn.py From PCWG with MIT License | 5 votes |
def __init__(self, parent): scrollbar = tk.Scrollbar(parent, orient=tk.VERTICAL) self.listbox = tk.Listbox(parent, yscrollcommand=scrollbar.set, selectmode=tk.EXTENDED) scrollbar.configure(command=self.listbox.yview) self.listbox.pack(side=tk.LEFT,fill=tk.BOTH, expand=1, pady=5) scrollbar.pack(side=tk.RIGHT, fill=tk.Y, pady=5)
Example #9
Source File: cs1media.py From cs101 with GNU General Public License v3.0 | 5 votes |
def picture_tool(filename = None): """Allows you to find information about digital images. The PictureTool's Toolbar: Once you have opened an image, you can view information about its individual pixels by looking at the toolbar. To select a pixel drag (click and hold down) the mouse to the position you want and then release it to hold that position's information in the toolbar. The following information in the toolbar changes to reflect the properties of the pixel you selected: X = the x coordinate of the pixel (starting with 0, counting from the left) Y = the y coordinate of the pixel (starting with 0, counting from the top) R = the Red value of the pixel (0 to 255) G = the Green value of the pixel (0 to 255) B = the Blue value of the pixel (0 to 255) In addition, the box at the far right displays the color of the pixel. Zooming in/out: To Zoom, select the amount of zoom you want from the zoom menu. Less than 100% zooms out and more than 100% zooms in. The 100% zoom level will always return you to your orginal picture. filename: a string representing the location and name of picture. If no filename is given, a file-chooser opens.""" if not filename: filename = _easygui.fileopenbox("Select an image", _sys.argv[0], '*', [ [ "*.jpg", "*.png", "*.bmp", "*.gif", "Image files" ] ]) if not filename: raise RuntimeError("No image file selected.") img = load_picture(filename) tool = PictureTool(img) tool.run_tool() # --------------------------------------------------------------------
Example #10
Source File: asktext.py From textext with BSD 3-Clause "New" or "Revised" License | 4 votes |
def show_error_dialog(self, title, message_text, exception): # ToDo: Check Windows behavior!! --> -disable self._root.wm_attributes("-topmost", False) err_dialog = Tk.Toplevel(self._frame) err_dialog.minsize(300, 400) err_dialog.transient(self._frame) err_dialog.focus_force() err_dialog.grab_set() def add_textview(header, text): err_dialog_frame = Tk.Frame(err_dialog) err_dialog_label = Tk.Label(err_dialog_frame, text=header) err_dialog_label.pack(side='top', fill=Tk.X) err_dialog_text = Tk.Text(err_dialog_frame, height=10) err_dialog_text.insert(Tk.END, text) err_dialog_text.pack(side='left', fill=Tk.Y) err_dialog_scrollbar = Tk.Scrollbar(err_dialog_frame) err_dialog_scrollbar.pack(side='right', fill=Tk.Y) err_dialog_scrollbar.config(command=err_dialog_text.yview) err_dialog_text.config(yscrollcommand=err_dialog_scrollbar.set) err_dialog_frame.pack(side='top') def close_error_dialog(): # ToDo: Check Windows behavior!! -disable self._root.wm_attributes("-topmost", True) err_dialog.destroy() err_dialog.protocol("WM_DELETE_WINDOW", close_error_dialog) add_textview(message_text, str(exception)) if isinstance(exception, TexTextCommandFailed): if exception.stdout: add_textview('Stdout:', exception.stdout.decode('utf-8')) if exception.stderr: add_textview('Stderr:', exception.stderr.decode('utf-8')) close_button = Tk.Button(err_dialog, text='OK', command=close_error_dialog) close_button.pack(side='top', fill='x', expand=True)
Example #11
Source File: demo.py From PyCV-time with MIT License | 4 votes |
def __init__(self): root = tk.Tk() root.title('OpenCV Demo') self.win = win = tk.PanedWindow(root, orient=tk.HORIZONTAL, sashrelief=tk.RAISED, sashwidth=4) self.win.pack(fill=tk.BOTH, expand=1) left = tk.Frame(win) right = tk.Frame(win) win.add(left) win.add(right) scrollbar = tk.Scrollbar(left, orient=tk.VERTICAL) self.demos_lb = demos_lb = tk.Listbox(left, yscrollcommand=scrollbar.set) scrollbar.config(command=demos_lb.yview) scrollbar.pack(side=tk.RIGHT, fill=tk.Y) demos_lb.pack(side=tk.LEFT, fill=tk.BOTH, expand=1) self.samples = {} for fn in glob('*.py'): name = splitfn(fn)[1] if fn[0] != '_' and name not in exclude_list: demos_lb.insert(tk.END, name) self.samples[name] = fn demos_lb.bind('<<ListboxSelect>>', self.on_demo_select) self.cmd_entry = cmd_entry = tk.Entry(right) cmd_entry.bind('<Return>', self.on_run) run_btn = tk.Button(right, command=self.on_run, text='Run', width=8) self.text = text = ScrolledText(right, font=('arial', 12, 'normal'), width = 30, wrap='word') self.linker = linker = LinkManager(text, self.on_link) self.text.tag_config("header1", font=('arial', 14, 'bold')) self.text.tag_config("header2", font=('arial', 12, 'bold')) text.config(state='disabled') text.pack(fill='both', expand=1, side=tk.BOTTOM) cmd_entry.pack(fill='x', side='left' , expand=1) run_btn.pack()
Example #12
Source File: demo.py From PyCV-time with MIT License | 4 votes |
def __init__(self): root = tk.Tk() root.title('OpenCV Demo') self.win = win = tk.PanedWindow(root, orient=tk.HORIZONTAL, sashrelief=tk.RAISED, sashwidth=4) self.win.pack(fill=tk.BOTH, expand=1) left = tk.Frame(win) right = tk.Frame(win) win.add(left) win.add(right) scrollbar = tk.Scrollbar(left, orient=tk.VERTICAL) self.demos_lb = demos_lb = tk.Listbox(left, yscrollcommand=scrollbar.set) scrollbar.config(command=demos_lb.yview) scrollbar.pack(side=tk.RIGHT, fill=tk.Y) demos_lb.pack(side=tk.LEFT, fill=tk.BOTH, expand=1) self.samples = {} for fn in glob('*.py'): name = splitfn(fn)[1] if fn[0] != '_' and name not in exclude_list: demos_lb.insert(tk.END, name) self.samples[name] = fn demos_lb.bind('<<ListboxSelect>>', self.on_demo_select) self.cmd_entry = cmd_entry = tk.Entry(right) cmd_entry.bind('<Return>', self.on_run) run_btn = tk.Button(right, command=self.on_run, text='Run', width=8) self.text = text = ScrolledText(right, font=('arial', 12, 'normal'), width = 30, wrap='word') self.linker = linker = LinkManager(text, self.on_link) self.text.tag_config("header1", font=('arial', 14, 'bold')) self.text.tag_config("header2", font=('arial', 12, 'bold')) text.config(state='disabled') text.pack(fill='both', expand=1, side=tk.BOTTOM) cmd_entry.pack(fill='x', side='left' , expand=1) run_btn.pack()
Example #13
Source File: demo.py From OpenCV-Python-Tutorial with MIT License | 3 votes |
def __init__(self): root = tk.Tk() root.title('OpenCV Demo') self.win = win = tk.PanedWindow(root, orient=tk.HORIZONTAL, sashrelief=tk.RAISED, sashwidth=4) self.win.pack(fill=tk.BOTH, expand=1) left = tk.Frame(win) right = tk.Frame(win) win.add(left) win.add(right) scrollbar = tk.Scrollbar(left, orient=tk.VERTICAL) self.demos_lb = demos_lb = tk.Listbox(left, yscrollcommand=scrollbar.set) scrollbar.config(command=demos_lb.yview) scrollbar.pack(side=tk.RIGHT, fill=tk.Y) demos_lb.pack(side=tk.LEFT, fill=tk.BOTH, expand=1) self.samples = {} for fn in glob('*.py'): name = splitfn(fn)[1] if fn[0] != '_' and name not in exclude_list: self.samples[name] = fn for name in sorted(self.samples): demos_lb.insert(tk.END, name) demos_lb.bind('<<ListboxSelect>>', self.on_demo_select) self.cmd_entry = cmd_entry = tk.Entry(right) cmd_entry.bind('<Return>', self.on_run) run_btn = tk.Button(right, command=self.on_run, text='Run', width=8) self.text = text = ScrolledText(right, font=('arial', 12, 'normal'), width = 30, wrap='word') self.linker = linker = LinkManager(text, self.on_link) self.text.tag_config("header1", font=('arial', 14, 'bold')) self.text.tag_config("header2", font=('arial', 12, 'bold')) text.config(state='disabled') text.pack(fill='both', expand=1, side=tk.BOTTOM) cmd_entry.pack(fill='x', side='left' , expand=1) run_btn.pack()