Python Tkinter.Scrollbar() Examples
The following are 30
code examples of Tkinter.Scrollbar().
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: chart.py From razzy-spinner with GNU General Public License v3.0 | 7 votes |
def _sb_canvas(self, root, expand='y', fill='both', side='bottom'): """ Helper for __init__: construct a canvas with a scrollbar. """ cframe =Tkinter.Frame(root, relief='sunk', border=2) cframe.pack(fill=fill, expand=expand, side=side) canvas = Tkinter.Canvas(cframe, background='#e0e0e0') # Give the canvas a scrollbar. sb = Tkinter.Scrollbar(cframe, orient='vertical') sb.pack(side='right', fill='y') canvas.pack(side='left', fill=fill, expand='yes') # Connect the scrollbars to the canvas. sb['command']= canvas.yview canvas['yscrollcommand'] = sb.set return (sb, canvas)
Example #2
Source File: pykms_GuiMisc.py From py-kms with The Unlicense | 6 votes |
def __init__(self, master, radios, font, changed, **kwargs): tk.Frame.__init__(self, master) self.master = master self.radios = radios self.font = font self.changed = changed self.scrollv = tk.Scrollbar(self, orient = "vertical") self.textbox = tk.Text(self, yscrollcommand = self.scrollv.set, **kwargs) self.scrollv.config(command = self.textbox.yview) # layout. self.scrollv.pack(side = "right", fill = "y") self.textbox.pack(side = "left", fill = "both", expand = True) # create radiobuttons. self.radiovar = tk.StringVar() self.radiovar.set('FILE') self.create()
Example #3
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 #4
Source File: ScrolledText.py From oss-ftp with MIT License | 6 votes |
def __init__(self, master=None, **kw): self.frame = Frame(master) self.vbar = Scrollbar(self.frame) self.vbar.pack(side=RIGHT, fill=Y) kw.update({'yscrollcommand': self.vbar.set}) Text.__init__(self, self.frame, **kw) self.pack(side=LEFT, fill=BOTH, expand=True) self.vbar['command'] = self.yview # Copy geometry methods of self.frame without overriding Text # methods -- hack! text_meths = vars(Text).keys() methods = vars(Pack).keys() + vars(Grid).keys() + vars(Place).keys() methods = set(methods).difference(text_meths) for m in methods: if m[0] != '_' and m != 'config' and m != 'configure': setattr(self, m, getattr(self.frame, m))
Example #5
Source File: ScrolledText.py From BinderFilter with MIT License | 6 votes |
def __init__(self, master=None, **kw): self.frame = Frame(master) self.vbar = Scrollbar(self.frame) self.vbar.pack(side=RIGHT, fill=Y) kw.update({'yscrollcommand': self.vbar.set}) Text.__init__(self, self.frame, **kw) self.pack(side=LEFT, fill=BOTH, expand=True) self.vbar['command'] = self.yview # Copy geometry methods of self.frame without overriding Text # methods -- hack! text_meths = vars(Text).keys() methods = vars(Pack).keys() + vars(Grid).keys() + vars(Place).keys() methods = set(methods).difference(text_meths) for m in methods: if m[0] != '_' and m != 'config' and m != 'configure': setattr(self, m, getattr(self.frame, m))
Example #6
Source File: turtle.py From BinderFilter with MIT License | 6 votes |
def __init__(self, master, width=500, height=350, canvwidth=600, canvheight=500): TK.Frame.__init__(self, master, width=width, height=height) self._rootwindow = self.winfo_toplevel() self.width, self.height = width, height self.canvwidth, self.canvheight = canvwidth, canvheight self.bg = "white" self._canvas = TK.Canvas(master, width=width, height=height, bg=self.bg, relief=TK.SUNKEN, borderwidth=2) self.hscroll = TK.Scrollbar(master, command=self._canvas.xview, orient=TK.HORIZONTAL) self.vscroll = TK.Scrollbar(master, command=self._canvas.yview) self._canvas.configure(xscrollcommand=self.hscroll.set, yscrollcommand=self.vscroll.set) self.rowconfigure(0, weight=1, minsize=0) self.columnconfigure(0, weight=1, minsize=0) self._canvas.grid(padx=1, in_ = self, pady=1, row=0, column=0, rowspan=1, columnspan=1, sticky='news') self.vscroll.grid(padx=1, in_ = self, pady=1, row=0, column=1, rowspan=1, columnspan=1, sticky='news') self.hscroll.grid(padx=1, in_ = self, pady=1, row=1, column=0, rowspan=1, columnspan=1, sticky='news') self.reset() self._rootwindow.bind('<Configure>', self.onResize)
Example #7
Source File: chartparser_app.py From luscan-devel with GNU General Public License v2.0 | 6 votes |
def _sb_canvas(self, root, expand='y', fill='both', side='bottom'): """ Helper for __init__: construct a canvas with a scrollbar. """ cframe =Tkinter.Frame(root, relief='sunk', border=2) cframe.pack(fill=fill, expand=expand, side=side) canvas = Tkinter.Canvas(cframe, background='#e0e0e0') # Give the canvas a scrollbar. sb = Tkinter.Scrollbar(cframe, orient='vertical') sb.pack(side='right', fill='y') canvas.pack(side='left', fill=fill, expand='yes') # Connect the scrollbars to the canvas. sb['command']= canvas.yview canvas['yscrollcommand'] = sb.set return (sb, canvas)
Example #8
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 #9
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 #10
Source File: turtle.py From Splunking-Crime with GNU Affero General Public License v3.0 | 6 votes |
def __init__(self, master, width=500, height=350, canvwidth=600, canvheight=500): TK.Frame.__init__(self, master, width=width, height=height) self._rootwindow = self.winfo_toplevel() self.width, self.height = width, height self.canvwidth, self.canvheight = canvwidth, canvheight self.bg = "white" self._canvas = TK.Canvas(master, width=width, height=height, bg=self.bg, relief=TK.SUNKEN, borderwidth=2) self.hscroll = TK.Scrollbar(master, command=self._canvas.xview, orient=TK.HORIZONTAL) self.vscroll = TK.Scrollbar(master, command=self._canvas.yview) self._canvas.configure(xscrollcommand=self.hscroll.set, yscrollcommand=self.vscroll.set) self.rowconfigure(0, weight=1, minsize=0) self.columnconfigure(0, weight=1, minsize=0) self._canvas.grid(padx=1, in_ = self, pady=1, row=0, column=0, rowspan=1, columnspan=1, sticky='news') self.vscroll.grid(padx=1, in_ = self, pady=1, row=0, column=1, rowspan=1, columnspan=1, sticky='news') self.hscroll.grid(padx=1, in_ = self, pady=1, row=1, column=0, rowspan=1, columnspan=1, sticky='news') self.reset() self._rootwindow.bind('<Configure>', self.onResize)
Example #11
Source File: ScrolledText.py From Splunking-Crime with GNU Affero General Public License v3.0 | 6 votes |
def __init__(self, master=None, **kw): self.frame = Frame(master) self.vbar = Scrollbar(self.frame) self.vbar.pack(side=RIGHT, fill=Y) kw.update({'yscrollcommand': self.vbar.set}) Text.__init__(self, self.frame, **kw) self.pack(side=LEFT, fill=BOTH, expand=True) self.vbar['command'] = self.yview # Copy geometry methods of self.frame without overriding Text # methods -- hack! text_meths = vars(Text).keys() methods = vars(Pack).keys() + vars(Grid).keys() + vars(Place).keys() methods = set(methods).difference(text_meths) for m in methods: if m[0] != '_' and m != 'config' and m != 'configure': setattr(self, m, getattr(self.frame, m))
Example #12
Source File: ListPanel.py From Python-Media-Player with Apache License 2.0 | 5 votes |
def create_song_list_panel(self): # Creating Picture Canvas as Background background=Tkinter.PhotoImage(file="../Icons/background.gif") mainframe=Tkinter.Canvas(self.root) mainframe.pack(side='top', expand='yes', fill='both') mainframe.image=background mainframe.create_image(0, 0, anchor="nw", image=background) frame0=Tkinter.Frame(mainframe) frame0.pack(side='top') Tkinter.Label(frame0, text='Search : ', bg='skyblue').pack(side='left', expand='yes', fill='x') Tkinter.Entry(frame0, textvariable=self.var1).pack(side='left', expand='yes', fill='x') frame0.bind_all('<Any-KeyPress>',self.search_song_trigger) frame=Tkinter.Frame(mainframe, bg='skyblue') frame.pack(side='top') self.list_box=Tkinter.Listbox(frame, bg='powderblue', font=list_box_song_list_font, width=list_box_width, height=list_box_height) scrollbar=Tkinter.Scrollbar(frame, bg='skyblue') scrollbar.pack(side='right',expand='yes',fill='y') scrollbar.config(command=self.list_box.yview) self.list_box.config(yscrollcommand=scrollbar.set) self.list_box.pack(expand='yes',fill='both',side='right') frame1=Tkinter.Frame(mainframe, bg='blue') frame1.pack(side='top', expand='yes',fill='x') add_fileicon=Tkinter.PhotoImage(file="../Icons/add_file.gif") add_directoryicon=Tkinter.PhotoImage(file="../Icons/add_directory.gif") list_file=[ (add_fileicon,'self.ask_for_play_song_direct'), (add_directoryicon,'self.ask_for_directory'), ] for i,j in list_file: storeobj=Tkinter.Button(frame1, image=i, command=eval(j), bg='blue') storeobj.pack(side='left') storeobj.image=i self.list_box.bind('<Double-Button-1>',self.play_on_click) return self.update_list_box_songs()
Example #13
Source File: ttk.py From Splunking-Crime with GNU Affero General Public License v3.0 | 5 votes |
def __init__(self, master=None, **kw): """Construct a Ttk Scrollbar with parent master. STANDARD OPTIONS class, cursor, style, takefocus WIDGET-SPECIFIC OPTIONS command, orient """ Widget.__init__(self, master, "ttk::scrollbar", kw)
Example #14
Source File: nemo_app.py From luscan-devel with GNU General Public License v2.0 | 5 votes |
def initScrollText(self,frm,txt,contents): scl = tk.Scrollbar(frm) scl.config(command = txt.yview) scl.pack(side="right",fill="y") txt.pack(side = "left", expand=True, fill="x") txt.config(yscrollcommand = scl.set) txt.insert("1.0",contents) frm.pack(fill = "x") tk.Frame(height=2, bd=1, relief="ridge").pack(fill="x")
Example #15
Source File: app.py From subfinder with MIT License | 5 votes |
def _create_widgets(self): self.button_open_file = tk.Button( self, text='选择文件', command=self._open_file) self.button_open_file.grid(row=0, column=0, sticky='nswe') self.button_open_directory = tk.Button( self, text='选择目录', command=self._open_directory) self.button_open_directory.grid(row=0, column=1, sticky='nswe') frame = tk.Frame(self) self.label = tk.Label(frame, text='选中的文件或目录:') self.label.pack(side=tk.LEFT) self.label_selected = tk.Label(frame, text=self.videofile) self.label_selected.pack(side=tk.LEFT) frame.grid(row=1, column=0, columnspan=2, sticky='nswe') self.button_start = tk.Button(self, text='开始', command=self._start) self.button_start.grid( row=2, column=0, columnspan=2, pady=20, sticky='nswe') frame = tk.Frame(self) self.text_logger = tk.Text(frame) self.scrollbar = tk.Scrollbar(frame, command=self.text_logger.yview) self.text_logger.configure(yscrollcommand=self.scrollbar.set) self.text_logger.grid(row=0, column=0, sticky='nswe') self.scrollbar.grid(row=0, column=1, sticky='ns') tk.Grid.rowconfigure(self, 0, weight=1) tk.Grid.columnconfigure(frame, 0, weight=1) # tk.Grid.columnconfigure(frame, 1, weight=1) frame.grid(row=3, column=0, columnspan=2, pady=20, sticky='nswe') self._output = OutputStream(self.text_logger) self.after(100, self._display_msg) tk.Grid.rowconfigure(self, 3, weight=1) tk.Grid.columnconfigure(self, 0, weight=1) tk.Grid.columnconfigure(self, 1, weight=1)
Example #16
Source File: strap_beam_gui.py From Structural-Engineering with BSD 3-Clause "New" or "Revised" License | 5 votes |
def strap_design_frame_builder(self): self.strap_inputs_frame = tk.Frame(self.strap_design_frame) self.strap_inputs_frame.pack(side=tk.LEFT, anchor='nw') self.strap_calc_frame = tk.Frame(self.strap_design_frame) self.strap_calc_frame.pack(side=tk.RIGHT ,anchor='ne', fill=tk.BOTH, expand=1) tk.Label(self.strap_inputs_frame, text="B = ", font=self.helv).grid(row=0, column=0, sticky = tk.E) tk.Entry(self.strap_inputs_frame, textvariable=self.bs, width=10, validate="key", validatecommand=self.reset_status).grid(row=0, column=1) tk.Label(self.strap_inputs_frame, text="in", font=self.helv).grid(row=0, column=2) tk.Label(self.strap_inputs_frame, text="H = ", font=self.helv).grid(row=1, column=0, sticky = tk.E) tk.Entry(self.strap_inputs_frame, textvariable=self.hs, width=10, validate="key", validatecommand=self.reset_status).grid(row=1, column=1) tk.Label(self.strap_inputs_frame, text="in", font=self.helv).grid(row=1, column=2) self.strap_vbar_size = tk.StringVar() self.inputs.append(self.strap_vbar_size) self.strap_vbar_size.set('3') self.strap_vbar_size_label = tk.Label(self.strap_inputs_frame, text="Shear\nBar Size (#) : ", font=self.helv) self.strap_vbar_size_label.grid(row=2,column=0, pady=2) self.strap_vbar_size_menu = tk.OptionMenu(self.strap_inputs_frame, self.strap_vbar_size, '3', '4', '5', command=self.reset_status) self.strap_vbar_size_menu.config(font=self.helv) self.strap_vbar_size_menu.grid(row=2, column=1, padx= 2, sticky=tk.W) self.strap_bar_size = tk.StringVar() self.inputs.append(self.strap_bar_size) self.strap_bar_size.set('3') self.strap_bar_size_label = tk.Label(self.strap_inputs_frame, text="Flexure\nBar Size (#) : ", font=self.helv) self.strap_bar_size_label.grid(row=4,column=0, pady=2) self.strap_bar_size_menu = tk.OptionMenu(self.strap_inputs_frame, self.strap_bar_size, '3', '4', '5','6','7','8','9','10','11','14','18', command=self.reset_status) self.strap_bar_size_menu.config(font=self.helv) self.strap_bar_size_menu.grid(row=4, column=1, padx= 2, sticky=tk.W) self.strap_calc_txtbox = tk.Text(self.strap_calc_frame, height = 25, width = 70, bg= "grey90", font= self.helv_norm, wrap=tk.WORD) self.strap_calc_txtbox.grid(row=0, column=0, sticky='nsew') self.strap_scroll = tk.Scrollbar(self.strap_calc_frame, command=self.strap_calc_txtbox.yview) self.strap_scroll.grid(row=0, column=1, sticky='nsew') self.strap_calc_txtbox['yscrollcommand'] = self.strap_scroll.set
Example #17
Source File: pcwg_tool_reborn.py From PCWG with MIT License | 5 votes |
def addListBox(self, master, title): scrollbar = tk.Scrollbar(master, orient=tk.VERTICAL) tipLabel = tk.Label(master, text="") tipLabel.grid(row = self.row, sticky=tk.W, column=self.tipColumn) lb = tk.Listbox(master, yscrollcommand=scrollbar, selectmode=tk.EXTENDED, height=3) self.listboxEntries[title] = ListBoxEntry(lb,scrollbar,tipLabel) self.row += 1 self.listboxEntries[title].scrollbar.configure(command=self.listboxEntries[title].listbox.yview) self.listboxEntries[title].scrollbar.grid(row=self.row, sticky=tk.W+tk.N+tk.S, column=self.titleColumn) return self.listboxEntries[title]
Example #18
Source File: help.py From Splunking-Crime with GNU Affero General Public License v3.0 | 5 votes |
def __init__(self, parent, filename): Frame.__init__(self, parent) text = HelpText(self, filename) self['background'] = text['background'] scroll = Scrollbar(self, command=text.yview) text['yscrollcommand'] = scroll.set self.rowconfigure(0, weight=1) self.columnconfigure(1, weight=1) # text self.toc_menu(text).grid(column=0, row=0, sticky='nw') text.grid(column=1, row=0, sticky='nsew') scroll.grid(column=2, row=0, sticky='ns')
Example #19
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 #20
Source File: base_dialog.py From PCWG with MIT License | 5 votes |
def addListBox(self, master, title, height = 3): scrollbar = tk.Scrollbar(master, orient=tk.VERTICAL) tipLabel = tk.Label(master, text="") tipLabel.grid(row = self.row, sticky=tk.W, column=self.tipColumn) lb = tk.Listbox(master, yscrollcommand=scrollbar, selectmode=tk.EXTENDED, height=height) self.listboxEntries[title] = ListBoxEntry(lb,scrollbar,tipLabel) self.row += 1 self.listboxEntries[title].scrollbar.configure(command=self.listboxEntries[title].listbox.yview) self.listboxEntries[title].scrollbar.grid(row=self.row, sticky=tk.W+tk.N+tk.S, column=self.titleColumn) return self.listboxEntries[title]
Example #21
Source File: test_widgets.py From oss-ftp with MIT License | 5 votes |
def create(self, **kwargs): return tkinter.Scrollbar(self.root, **kwargs)
Example #22
Source File: turtle.py From oss-ftp with MIT License | 5 votes |
def __init__(self, master, width=500, height=350, canvwidth=600, canvheight=500): TK.Frame.__init__(self, master, width=width, height=height) self._rootwindow = self.winfo_toplevel() self.width, self.height = width, height self.canvwidth, self.canvheight = canvwidth, canvheight self.bg = "white" self._canvas = TK.Canvas(master, width=width, height=height, bg=self.bg, relief=TK.SUNKEN, borderwidth=2) self.hscroll = TK.Scrollbar(master, command=self._canvas.xview, orient=TK.HORIZONTAL) self.vscroll = TK.Scrollbar(master, command=self._canvas.yview) self._canvas.configure(xscrollcommand=self.hscroll.set, yscrollcommand=self.vscroll.set) self.rowconfigure(0, weight=1, minsize=0) self.columnconfigure(0, weight=1, minsize=0) self._canvas.grid(padx=1, in_ = self, pady=1, row=0, column=0, rowspan=1, columnspan=1, sticky='news') self.vscroll.grid(padx=1, in_ = self, pady=1, row=0, column=1, rowspan=1, columnspan=1, sticky='news') self.hscroll.grid(padx=1, in_ = self, pady=1, row=1, column=0, rowspan=1, columnspan=1, sticky='news') self.reset() self._rootwindow.bind('<Configure>', self.onResize)
Example #23
Source File: ttk.py From oss-ftp with MIT License | 5 votes |
def __init__(self, master=None, **kw): """Construct a Ttk Scrollbar with parent master. STANDARD OPTIONS class, cursor, style, takefocus WIDGET-SPECIFIC OPTIONS command, orient """ Widget.__init__(self, master, "ttk::scrollbar", kw)
Example #24
Source File: test_widgets.py From PokemonGo-DesktopMap with MIT License | 5 votes |
def create(self, **kwargs): return tkinter.Scrollbar(self.root, **kwargs)
Example #25
Source File: ttk.py From BinderFilter with MIT License | 5 votes |
def __init__(self, master=None, **kw): """Construct a Ttk Scrollbar with parent master. STANDARD OPTIONS class, cursor, style, takefocus WIDGET-SPECIFIC OPTIONS command, orient """ Widget.__init__(self, master, "ttk::scrollbar", kw)
Example #26
Source File: PPA.py From PhotoPolarAlign with The Unlicense | 5 votes |
def create_imgwin(self, img_fn, title): ''' creates a window to display an image ''' from os.path import basename # create child window img = PhotoImage(file=img_fn) win = Toplevel() wwid = min(800, img.width()) whei = min(800, img.height()) win.geometry(('%dx%d' % (wwid+28, whei+28))) win.title(basename(title)) frame = Frame(win, bd=0) frame.pack() xscrollbar = Scrollbar(frame, orient='horizontal') xscrollbar.pack(side='bottom', fill='x') yscrollbar = Scrollbar(frame, orient='vertical') yscrollbar.pack(side='right', fill='y') canvas = Canvas(frame, bd=0, width=wwid, height=whei, scrollregion=(0, 0, img.width(), img.height()), xscrollcommand=xscrollbar.set, yscrollcommand=yscrollbar.set) canvas.pack(side='top', fill='both', expand=1) canvas.create_image(0, 0, image=img, anchor='nw') xscrollbar.config(command=canvas.xview) yscrollbar.config(command=canvas.yview) frame.pack() # next statement is important! creates reference to img canvas.img = img
Example #27
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 #28
Source File: plot.py From razzy-spinner with GNU General Public License v3.0 | 5 votes |
def __init__(self, root, vals, rng): self._root = root self._original_rng = rng self._original_vals = vals self._frame = Tkinter.Frame(root) self._frame.pack(expand=1, fill='both') # Set up the canvas self._canvas = Tkinter.Canvas(self._frame, background='white') self._canvas['scrollregion'] = (0,0,200,200) # Give the canvas scrollbars. sb1 = Tkinter.Scrollbar(self._frame, orient='vertical') sb1.pack(side='right', fill='y') sb2 = Tkinter.Scrollbar(self._frame, orient='horizontal') sb2.pack(side='bottom', fill='x') self._canvas.pack(side='left', fill='both', expand=1) # Connect the scrollbars to the canvas. sb1.config(command=self._canvas.yview) sb2['command']=self._canvas.xview self._canvas['yscrollcommand'] = sb1.set self._canvas['xscrollcommand'] = sb2.set self._width = self._height = -1 self._canvas.bind('<Configure>', self._configure) # Start out with linear coordinates. self.config_axes(0, 0)
Example #29
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 #30
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()