• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python ttk.Scrollbar类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中tkinter.ttk.Scrollbar的典型用法代码示例。如果您正苦于以下问题:Python Scrollbar类的具体用法?Python Scrollbar怎么用?Python Scrollbar使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Scrollbar类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: TextViewer

class TextViewer(Toplevel):
    "A simple text viewer dialog for IDLE."

    def __init__(self, parent, title, text, modal=True,
                 _htest=False, _utest=False):
        """Show the given text in a scrollable window with a 'close' button.

        If modal is left True, users cannot interact with other windows
        until the textview window is closed.

        _htest - bool; change box location when running htest.
        _utest - bool; don't wait_window when running unittest.
        """
        Toplevel.__init__(self, parent)
        self.configure(borderwidth=5)
        # Place dialog below parent if running htest.
        self.geometry("=%dx%d+%d+%d" % (750, 500,
                           parent.winfo_rootx() + 10,
                           parent.winfo_rooty() + (10 if not _htest else 100)))
        # TODO: get fg/bg from theme.
        self.bg = '#ffffff'
        self.fg = '#000000'

        self.CreateWidgets()
        self.title(title)
        self.protocol("WM_DELETE_WINDOW", self.Ok)
        self.parent = parent
        self.textView.focus_set()
        # Bind keys for closing this dialog.
        self.bind('<Return>',self.Ok)
        self.bind('<Escape>',self.Ok)
        self.textView.insert(0.0, text)
        self.textView.config(state=DISABLED)

        if modal:
            self.transient(parent)
            self.grab_set()
            if not _utest:
                self.wait_window()

    def CreateWidgets(self):
        "Create Frame with Text (with vertical Scrollbar) and Button."
        frameText = Frame(self, relief=SUNKEN, height=700)
        frameButtons = Frame(self)
        self.buttonOk = Button(frameButtons, text='Close',
                               command=self.Ok, takefocus=FALSE)
        self.scrollbarView = Scrollbar(frameText, orient=VERTICAL,
                                       takefocus=FALSE)
        self.textView = Text(frameText, wrap=WORD, highlightthickness=0,
                             fg=self.fg, bg=self.bg)
        self.scrollbarView.config(command=self.textView.yview)
        self.textView.config(yscrollcommand=self.scrollbarView.set)
        self.buttonOk.pack()
        self.scrollbarView.pack(side=RIGHT,fill=Y)
        self.textView.pack(side=LEFT,expand=TRUE,fill=BOTH)
        frameButtons.pack(side=BOTTOM,fill=X)
        frameText.pack(side=TOP,expand=TRUE,fill=BOTH)

    def Ok(self, event=None):
        self.destroy()
开发者ID:varunsharma,项目名称:cpython,代码行数:60,代码来源:textview.py


示例2: CimReadme

class CimReadme(Toplevel):
    def __init__(self, parent):
        Toplevel.__init__(self, parent)
        self.configure(borderwidth=0)
        self.geometry("+%d+%d" % (
                        parent.winfo_rootx()+30,
                        parent.winfo_rooty()+30))

        self.vbar = Scrollbar(self)
        self.text = Text(self, wrap='word', borderwidth='0p')
        self.vbar['command'] = self.text.yview
        self.vbar.pack(side=RIGHT, fill='y')
        self.text['yscrollcommand'] = self.vbar.set
        self.text.pack(expand=1, fill="both")
        try:
            f = open(README_PATH)
            self.text.delete(1.0)
            self.text.insert(1.0, f.read())
            self.text.delete('end - 1 chars')
        except:
            showerror("Error", "Cannot load README!")
        self.text.config(state='disabled')

        self.title('README')
        self.protocol("WM_DELETE_WINDOW", self.close)
        self.parent = parent
        self.bind('<Escape>', self.close)

    def close(self, event=None):
        self.destroy()

    def show(parent):
        dlg = CimReadme(parent)
        dlg.lift()
        dlg.focus_set()
开发者ID:ZanderBrown,项目名称:Tiborcim,代码行数:35,代码来源:cim.py


示例3: __init__

	def __init__(self,parent):
		
		Frame.__init__(self, master=parent)

		canvas = tkinter.Canvas(self, highlightthickness=0)
		self.innerFrame = Frame(canvas)

		myscrollbar = Scrollbar(self, orient="vertical")
		myscrollbar.configure(command=canvas.yview)

		def scrollbarSet(top, bottom):
			# Hides and shows the scroll frame depending on need
			if float(top) > 0 or float(bottom) < 1:
				myscrollbar.grid(row=0, column=1, sticky="NS")
			else:
				pass
				myscrollbar.grid_remove()
			myscrollbar.set(top, bottom)
		canvas.configure(yscrollcommand = scrollbarSet)


		configureFunc = lambda _ :  canvas.configure(scrollregion=canvas.bbox("all"))
		frameID = canvas.create_window((0,0), window=self.innerFrame, anchor='nw')
		self.innerFrame.bind("<Configure>",configureFunc)

		canvas.grid(row=0, column=0, sticky="NSEW")
		myscrollbar.grid(row=0, column=1, sticky="NS")
		self.grid_rowconfigure(0, weight=1)
		self.grid_columnconfigure(0, weight=0)


		#canvas.bind("<Configure>", lambda e : canvas.itemconfig(frameID, width=e.width))
		canvas.bind("<Configure>", lambda e : canvas.configure(width=self.innerFrame.winfo_width()))
开发者ID:volcan01010,项目名称:AshCalc,代码行数:33,代码来源:custom_components.py


示例4: __init__

    def __init__(self, parent):
        Notebook.__init__(self, parent, style='Type.TNotebook')
        logger = logging.getLogger(__name__)

        s = Style()
        s.configure('Type.TNotebook', tabposition="se")
        
        self.page_tiborcim = Frame(self)
        self.page_python = Frame(self)
        self.add(self.page_tiborcim, text='Tiborcim')
        self.add(self.page_python, text='Python')

        self.text_tiborcim = CimTiborcimText(self.page_tiborcim, self)

        self.vbar_python = Scrollbar(self.page_python, name='vbar_python')
        self.xbar_python = Scrollbar(self.page_python, name='xbar_python', orient="horizontal")
        self.text_python = Text(self.page_python, wrap="none", state="disabled", borderwidth='0p')
        self.vbar_python['command'] = self.text_python.yview
        self.vbar_python.pack(side="right", fill="y")
        self.text_python['yscrollcommand'] = self.vbar_python.set
        self.xbar_python['command'] = self.text_python.xview
        self.xbar_python.pack(side="bottom", fill="x")
        self.text_python['xscrollcommand'] = self.xbar_python.set
        self.text_python.pack(expand=1, fill="both")

        self.viewmode = "tiborcim"
        self.saved = True
        self.filename = None
开发者ID:ZanderBrown,项目名称:Tiborcim,代码行数:28,代码来源:cim.py


示例5: _addNeueMahlzeitFrame

    def _addNeueMahlzeitFrame(self):
        self.fr_neue_mz = Frame(self.fr_mahlzeit)
        self.fr_neue_mz.grid_rowconfigure(2, weight=1)
        self.fr_neue_mz.grid(row=0, column=1, sticky="WSNE")
        
        lbl_name = Label(self.fr_neue_mz, text="Name:")
        lbl_name.grid(row=0, column=0, sticky="NW")
        
        self.en_name = Entry(self.fr_neue_mz)
        self.en_name.grid(row=0, column=1, columnspan=2, sticky="WNE")
        
        lbl_zutat = Label(self.fr_neue_mz, text="Zutaten:")
        lbl_zutat.grid(row=1, column=0, sticky="NW")
        

        self.lb_zutat = Listbox(self.fr_neue_mz)
        sb_zutat = Scrollbar(self.lb_zutat, orient=VERTICAL)
        self.lb_zutat.configure(yscrollcommand=sb_zutat.set)
        sb_zutat.configure(command=self.lb_zutat.yview)
        sb_zutat.pack(side="right", fill="both")
        self.lb_zutat.grid(row=2, column=0, columnspan=3, sticky="NWSE")
        
        self.var_zutat = StringVar(self.fr_neue_mz)
        
        self.opt_zutat = OptionMenu(self.fr_neue_mz, self.var_zutat, "Auswahl")
        self.opt_zutat.grid(row=3, column=0)
        
        self.en_menge = Entry(self.fr_neue_mz)
        self.en_menge.grid(row=3, column=1)
        
        self.btn_mahlzeit_hinzu = Button(self.fr_neue_mz, text="Hinzu")
        self.btn_mahlzeit_hinzu.grid(row=3, column=2, sticky="E")
开发者ID:karacho84,项目名称:dinnerlog,代码行数:32,代码来源:gui.py


示例6: create_widgets

    def create_widgets(self):
        ''' Creates widgets of this object.
        '''
        yScrollbar = Scrollbar(self, orient=VERTICAL)
        yScrollbar.grid(row=2, column=3, sticky=N+S)

        canvas = StyledCanvas(self, height=HEIGHT_WITHOUT_CHECKBOXES,
                              yscrollcommand=yScrollbar.set)
        self.canvas = canvas
        canvas.grid(row=2, column=0, columnspan=3, sticky=N+E+W)

        self._config_columns(self)
        canvas.columnconfigure(0, weight=1)

        if self.add_headers:
            non_discr_lbl = Label(self, text='Non-\ndiscretionary')
            non_discr_lbl.grid(row=0, column=1, padx=3, pady=1)
            weakly_disp_lbl = Label(self, text='Weakly\ndisposable')
            weakly_disp_lbl.grid(row=0, column=2, padx=3, pady=1)
            sep = Separator(self)
            sep.grid(row=1, column=0, columnspan=3, sticky=E+W, pady=10, padx=3)

        self.frame_with_boxes = Frame(canvas)
        self._config_columns(self.frame_with_boxes)
        self.frame_with_boxes.grid(sticky=N+S+W+E, pady=15, padx=3)

        canvas.create_window(0, 0, window=self.frame_with_boxes, anchor=N+W)
        canvas.update_idletasks()

        canvas['scrollregion'] = (0, 0, 0, HEIGHT_WITHOUT_CHECKBOXES)
        yScrollbar['command'] = canvas.yview

        MouseWheel(self).add_scrolling(canvas, yscrollbar=yScrollbar)
开发者ID:nishimaomaoxiong,项目名称:pyDEA,代码行数:33,代码来源:categories_checkbox_gui.py


示例7: TextViewer

class TextViewer(Toplevel):
    """A simple text viewer dialog for IDLE

    """
    def __init__(self, parent, title, text, modal=True, _htest=False):
        """Show the given text in a scrollable window with a 'close' button

        If modal option set to False, user can interact with other windows,
        otherwise they will be unable to interact with other windows until
        the textview window is closed.

        _htest - bool; change box location when running htest.
        """
        Toplevel.__init__(self, parent)
        self.configure(borderwidth=5)
        # place dialog below parent if running htest
        self.geometry("=%dx%d+%d+%d" % (750, 500,
                           parent.winfo_rootx() + 10,
                           parent.winfo_rooty() + (10 if not _htest else 100)))
        #elguavas - config placeholders til config stuff completed
        self.bg = '#ffffff'
        self.fg = '#000000'

        self.CreateWidgets()
        self.title(title)
        self.protocol("WM_DELETE_WINDOW", self.Ok)
        self.parent = parent
        self.textView.focus_set()
        #key bindings for this dialog
        self.bind('<Return>',self.Ok) #dismiss dialog
        self.bind('<Escape>',self.Ok) #dismiss dialog
        self.textView.insert(0.0, text)
        self.textView.config(state=DISABLED)

        if modal:
            self.transient(parent)
            self.grab_set()
            self.wait_window()

    def CreateWidgets(self):
        frameText = Frame(self, relief=SUNKEN, height=700)
        frameButtons = Frame(self)
        self.buttonOk = Button(frameButtons, text='Close',
                               command=self.Ok, takefocus=FALSE)
        self.scrollbarView = Scrollbar(frameText, orient=VERTICAL,
                                       takefocus=FALSE)
        self.textView = Text(frameText, wrap=WORD, highlightthickness=0,
                             fg=self.fg, bg=self.bg)
        self.scrollbarView.config(command=self.textView.yview)
        self.textView.config(yscrollcommand=self.scrollbarView.set)
        self.buttonOk.pack()
        self.scrollbarView.pack(side=RIGHT,fill=Y)
        self.textView.pack(side=LEFT,expand=TRUE,fill=BOTH)
        frameButtons.pack(side=BOTTOM,fill=X)
        frameText.pack(side=TOP,expand=TRUE,fill=BOTH)

    def Ok(self, event=None):
        self.destroy()
开发者ID:Niansheng,项目名称:cpython,代码行数:58,代码来源:textview.py


示例8: ListDialog

class ListDialog(object):
    def __init__ (self, master, items, message, accept_func):
        self.accept_func = accept_func

        self.top = Toplevel(master)
        self.top.transient(master)
        self.top.rowconfigure(0, weight=1)
        self.top.rowconfigure(1, weight=3)
        self.top.rowconfigure(2, weight=0)
        self.top.columnconfigure(0, weight=1)
        self.top.columnconfigure(1, weight=1)
        self.top.resizable(width=True, height=True)

        self.frame = Frame(self.top)
        self.frame.rowconfigure(0, weight=1)
        self.frame.rowconfigure(1, weight=0)
        self.frame.columnconfigure(0, weight=1)
        self.frame.columnconfigure(1, weight=0)
        self.frame.grid(row=0, column=0, sticky=(N, S, W, E), columnspan=2)
        self.canvas = Canvas(self.frame)
        self.canvas.create_text(0, 0, text=message, anchor=NW)
        self.canvas.grid(row=0, column=0, sticky=(N, W, S, E))

        self.vscroll = Scrollbar(self.frame, command=self.canvas.yview)
        self.vscroll.grid(row=0, column=1, sticky=(N, S))
        self.canvas['yscrollcommand'] = self.vscroll.set

        self.hscroll = Scrollbar(self.frame, command=self.canvas.xview, orient=HORIZONTAL)
        self.hscroll.grid(row=1, column=0, sticky=(W, E), columnspan=2)
        self.canvas['xscrollcommand'] = self.hscroll.set

        self.canvas['scrollregion'] = self.canvas.bbox('all')
        self.canvas.bind('<Button-4>', self.scroll)
        self.canvas.bind('<Button-5>', self.scroll)
        self.canvas.bind('<MouseWheel>', self.scroll)

        self.view = NameView(self.top, sorted(items))
        self.view.widget.grid(row=1, column=0, columnspan=2, sticky=(N, W, E, S))

        self.delbutton = Button(self.top, text='Ok', command=self.accept )
        self.cancelbutton = Button(self.top, text='Cancel', command=self.cancel)
        self.delbutton.grid(row=2, column=0)
        self.cancelbutton.grid(row=2, column=1)
        self.view.widget.focus_set()

    def accept(self):
        self.accept_func(self.view.selection())
        self.top.destroy()

    def cancel(self):
        self.result = None
        self.top.destroy()

    def scroll(self, event):
        if event.num == 4 or event.delta > 0:
            self.canvas.yview(SCROLL, -1, UNITS)
        elif event.num == 5 or event.delta < 0:
            self.canvas.yview(SCROLL, 1, UNITS)
开发者ID:gokai,项目名称:tim,代码行数:58,代码来源:dialog.py


示例9: progress

 def progress( self ):
     o=os.popen("cd {0} && snakemake --dryrun --rerun-incomplete > {0}/Reports/checkpoint".format(self.workpath.get()))
     o.close()
     F=open("{0}/Reports/checkpoint".format(self.workpath.get()),"r").read()
     rules2={}
     rules=re.findall(r'rule .+:',F)
     for i in rules:
         i=re.sub("rule ","",i)
         i=re.sub(":","",i)
         rules2[i]=0
 
 
     F=open("{0}/Reports/{1}.dot".format(self.workpath.get(), self.Pipeline.get() ),"r").read()
     for i in rules2.keys():
         F=re.sub(r'('+i+')(\".+?)\".+?\"',r'\1_pending\2"0.0 0.0 0.0"',F)
 #        F=re.sub(i,"",F)
 
 
     G=open("{0}/Reports/{1}-{2}.dot".format(self.workpath.get(),self.Pipeline.get(),"progress"),"w")
     G.write(F)
     G.close()
 
     o=os.popen("cd {0}/Reports && dot -Tpng -o {0}/Reports/{1}-progress.png {0}/Reports/{1}-progress.dot;convert {0}/Reports/{1}-progress.png {0}/Reports/{1}-progress.gif".format(self.workpath.get(),self.Pipeline.get()))
 
 #    tkinter.messagebox.showerror("o",o)
 
     PL=self.Pipeline.get() #pipelineget()
     gf=Toplevel()
 
     gf.title("CCBR Pipeliner: {0} Progress Graph".format(PL))
     cgf = Canvas(gf,bg="white")
 #    gff=Frame(cgf,width=300,height=300)
     xscrollbar = Scrollbar(gf, orient=HORIZONTAL)
     xscrollbar.pack(side = BOTTOM, fill=X )
     xscrollbar.config(command=cgf.xview)
 
     yscrollbar = Scrollbar(gf,orient=VERTICAL)
     yscrollbar.pack(side = RIGHT, fill=Y )
     yscrollbar.config(command=cgf.yview)
 
     cgf.config(xscrollcommand=xscrollbar.set, yscrollcommand=yscrollbar.set)
     cgf.config(width=600,height=600)
     cgf.pack(expand=1,fill=BOTH,side=RIGHT)
     cgf.config(scrollregion=(0,0,1000,5000))
     try:
         time.sleep(5)
         img = PhotoImage(file="{0}/Reports/{1}-progress.gif".format(self.workpath.get(),PL))
     except:
         time.sleep(5)
         img = PhotoImage(file="{0}/Reports/{1}-progress.gif".format(self.workpath.get(),PL))
     cgf.create_image(0,0,image=img, anchor="nw")
     cgf.image=img
开发者ID:felloumi,项目名称:Pipeliner,代码行数:52,代码来源:frame.py


示例10: CopilotInnerFrame

class CopilotInnerFrame(CopilotBaseFrame):
    def __init__(self, master, config):
        super(CopilotInnerFrame, self).__init__(master, config)

        if config.full_screen:
            self._make_full(master)

        self.master.grid_rowconfigure(1, weight=1)
        self.master.grid_columnconfigure(1, weight=1)

        self._create_header()

        self._sb = Scrollbar(self._master, orient=VERTICAL)
        self._sb.grid(row=1, column=3, sticky='nse')

        self._next_hidden = False

    def _cmd_back(self):
        self._master.destroy()

    def _create_header(self):
        self.back_btn = Button(
            self._master,
            text='< Back',
            command=self._cmd_back
        )
        self.back_btn.grid(row=0, column=0, sticky='w')

        self._frame_lbl = Label(
            self.master,
            text='',
            anchor='center',
            font=self._config.item_font
        )
        self._frame_lbl.grid(row=0, column=1, sticky='ew')

        self._next_btn = Button(
            self.master,
            text='Next >'
        )
        self._next_btn.grid(row=0, column=2, sticky='e')

    def _hide_next(self):
        if not self._next_hidden:
            self._next_btn.grid_remove()
            self._next_hidden = True

    def _show_next(self):
        if self._next_hidden:
            self._next_btn.grid(row=0, column=2, sticky='e')
            self._next_hidden = False
开发者ID:aphistic,项目名称:copilot,代码行数:51,代码来源:frame.py


示例11: __init__

 def __init__(self, master, names):
     self.widget = Frame(master)
     self._tree = Treeview(self.widget, columns='name')
     self._tree.grid(row=0,column=0, sticky=(N,S,W,E))
     self._tree.view = self
     self.widget.columnconfigure(0, weight=1)
     self.widget.rowconfigure(0,weight=1)
     self._tree.column('name', width=50)
     self._tree['show'] = 'tree'
     actions = {'edit': lambda e: self.edit(),
             'search': lambda e: self.search(),
             'focus_next': lambda e: self.focus_next(),
             'focus_prev': lambda e: self.focus_prev(),
             'select': lambda e: self._tree.selection_toggle(self._tree.focus()),
             'clear_selection': lambda e: self._tree.selection_set([])
             }
     kb.make_bindings(kb.tagview, actions, self._tree.bind)
     self._iids = dict()
     self._names = dict()
     logger.debug('Names: %s', names)
     self.widget.focus_set = self._tree.focus_set
     for name in sorted(names):
         iid = self._tree.insert('', 'end', text=name)
         self._names[iid] = name
         self._iids[name] = iid
     self._scroll = Scrollbar(self.widget, command=self._tree.yview)
     self._tree['yscrollcommand'] = self._scroll.set
     self._scroll.grid(row=0, column=1, sticky=(N, S))
     self.widget.columnconfigure(1, weight=0)
开发者ID:gokai,项目名称:tim,代码行数:29,代码来源:tagview.py


示例12: __init__

    def __init__( self, parentApp, internalBible ):
        """
        Given a collection name, try to open an empty Bible resource collection window.
        """
        if BibleOrgSysGlobals.debugFlag: print( "BibleReferenceCollectionWindow.__init__( {}, {} )".format( parentApp, internalBible.name ) )
        self.parentApp, self.internalBible = parentApp, internalBible
        BibleResourceWindow.__init__( self, self.parentApp, 'BibleReferenceCollectionWindow', internalBible.name )
        #ChildWindow.__init__( self, self.parentApp, 'BibleResource' )
        #self.winType = 'InternalBibleReferenceBox'

        self.geometry( INITIAL_REFERENCE_COLLECTION_SIZE )
        self.minimumSize, self.maximumSize = MINIMUM_REFERENCE_COLLECTION_SIZE, MAXIMUM_REFERENCE_COLLECTION_SIZE
        self.minsize( *parseWindowSize( self.minimumSize ) )
        self.maxsize( *parseWindowSize( self.maximumSize ) )

        # Get rid of the default widgets
        self.vScrollbar.destroy()
        self.textBox.destroy()

        # Make a frame inside a canvas inside our window (in order to get a scrollbar)
        self.canvas = tk.Canvas( self, borderwidth=0, background="#ffffff" )
        self.frame = Frame( self.canvas ) #, background="#ffffff" )
        self.vsb = Scrollbar( self, orient="vertical", command=self.canvas.yview )
        self.canvas.configure( yscrollcommand=self.vsb.set )
        self.vsb.pack( side="right", fill="y" )
        self.canvas.pack( side=tk.LEFT, fill=tk.BOTH, expand=True )
        self.canvas.create_window( (4,4), window=self.frame, anchor="nw", tags="self.frame" )
        self.frame.bind( "<Configure>", self.OnFrameConfigure )

        #self.BCVUpdateType = 'ReferencesMode' # Leave as default
        self.folderPath = self.filename = self.filepath = None
        self.referenceBoxes = BibleReferenceBoxes( self )
开发者ID:alerque,项目名称:Biblelator,代码行数:32,代码来源:BibleReferenceCollection.py


示例13: __init__

    def __init__( self, parentWindow, filename=None ):
        """
        """
        if BibleOrgSysGlobals.debugFlag and debuggingThisModule:
            print( exp("HTMLWindow.__init__( {}, {} )").format( parentWindow, repr(filename) ) )
            assert( parentWindow )
        self.parentWindow, self.initialFilename = parentWindow, filename
        tk.Toplevel.__init__( self, self.parentWindow )
        ChildBox.__init__( self, self.parentWindow )
        self.protocol( "WM_DELETE_WINDOW", self.closeHTMLWindow )
        self.title( 'HTMLWindow' )
        self.genericWindowType = 'HTMLWindow'
        self.winType = 'HTMLWindow'
        self.moduleID = 'HTML'

        self.geometry( INITIAL_HTML_SIZE )
        self.minimumSize, self.maximumSize = MINIMUM_HTML_SIZE, MAXIMUM_HTML_SIZE
        self.minsize( *parseWindowSize( self.minimumSize ) )
        self.maxsize( *parseWindowSize( self.maximumSize ) )

        self._showStatusBarVar = tk.BooleanVar()
        self._showStatusBarVar.set( True )
        self._statusTextVar = tk.StringVar()
        self._statusTextVar.set( '' ) # first initial value

        self.createMenuBar()
        self.createToolBar()
        self.createContextMenu()
        if self._showStatusBarVar.get(): self.createStatusBar()

        self.viewMode = DEFAULT
        self.settings = None

        # Create a scroll bar to fill the right-hand side of the window
        self.vScrollbar = Scrollbar( self )
        self.vScrollbar.pack( side=tk.RIGHT, fill=tk.Y )

        #if 'textBox' in dir(self): # we have one already -- presumably a specialised one
            #halt # We have one already
        #else: # let's make one

        self.textBox = HTMLText( self, yscrollcommand=self.vScrollbar.set, state=tk.DISABLED )
        self.textBox['wrap'] = 'word'
        self.textBox.pack( expand=tk.YES, fill=tk.BOTH )
        self.vScrollbar.config( command=self.textBox.yview ) # link the scrollbar to the text box
        self.createStandardKeyboardBindings()
        self.textBox.bind( "<Button-1>", self.setFocus ) # So disabled text box can still do select and copy functions

        # Options for find, etc.
        self.optionsDict = {}
        self.optionsDict['caseinsens'] = True

        if filename:
            self.historyList = [ filename ]
            self.historyIndex = 1 # Number from the end (starting with 1)
            self.load( filename )
        else:
            self.historyList = []
            self.historyIndex = 0 # = None
开发者ID:alerque,项目名称:Biblelator,代码行数:59,代码来源:ChildWindows.py


示例14: Table

class Table(Frame):
    def __init__(self, parent, title, columns):
        Frame.__init__(self, parent)
        self.pack(expand=YES, fill=BOTH)

        self.title_lbl = Label(self, text=title, font=GENERAL_FONT)
        self.table_tree = Treeview(self, columns=columns)

        # добавить Scrollbar
        self.scroll = Scroll(self, orient=VERTICAL, command=self.table_tree.yview)
        self.table_tree['yscroll'] = self.scroll.set

        for i in range(len(columns)):
            self.table_tree.heading(columns[i], text=columns[i])

        self.place_widgets()

    def place_widgets(self):
        self.title_lbl.pack(side=TOP, fill=X, expand=YES)
        self.table_tree.pack(side=LEFT, fill=BOTH, expand=YES)
        self.scroll.pack(side=RIGHT, fill=Y, expand=YES)
开发者ID:fargelus,项目名称:SAPR,代码行数:21,代码来源:generaltable.py


示例15: __init__

class ScrolledCanvas:
    def __init__(self, master, **opts):
        if 'yscrollincrement' not in opts:
            opts['yscrollincrement'] = 17
        self.master = master
        self.frame = Frame(master)
        self.frame.rowconfigure(0, weight=1)
        self.frame.columnconfigure(0, weight=1)
        self.canvas = Canvas(self.frame, **opts)
        self.canvas.grid(row=0, column=0, sticky="nsew")
        self.vbar = Scrollbar(self.frame, name="vbar")
        self.vbar.grid(row=0, column=1, sticky="nse")
        self.hbar = Scrollbar(self.frame, name="hbar", orient="horizontal")
        self.hbar.grid(row=1, column=0, sticky="ews")
        self.canvas['yscrollcommand'] = self.vbar.set
        self.vbar['command'] = self.canvas.yview
        self.canvas['xscrollcommand'] = self.hbar.set
        self.hbar['command'] = self.canvas.xview
        self.canvas.bind("<Key-Prior>", self.page_up)
        self.canvas.bind("<Key-Next>", self.page_down)
        self.canvas.bind("<Key-Up>", self.unit_up)
        self.canvas.bind("<Key-Down>", self.unit_down)
        #if isinstance(master, Toplevel) or isinstance(master, Tk):
        self.canvas.bind("<Alt-Key-2>", self.zoom_height)
        self.canvas.focus_set()
    def page_up(self, event):
        self.canvas.yview_scroll(-1, "page")
        return "break"
    def page_down(self, event):
        self.canvas.yview_scroll(1, "page")
        return "break"
    def unit_up(self, event):
        self.canvas.yview_scroll(-1, "unit")
        return "break"
    def unit_down(self, event):
        self.canvas.yview_scroll(1, "unit")
        return "break"
    def zoom_height(self, event):
        zoomheight.zoom_height(self.master)
        return "break"
开发者ID:1st1,项目名称:cpython,代码行数:40,代码来源:tree.py


示例16: scroll

def scroll(view, vert=True, horiz=True, resize=True):
    """Sets up scrollbars on view's master.
    
    The view should not have any layout settings of its own."""
    
    kw = dict()
    if resize:
        if not horiz:
            kw.update(rowspan=2)
        if not vert:
            kw.update(colspan=2)
    view.grid(sticky=(tkinter.EW, tkinter.NS), **kw)
    
    view.master.rowconfigure(0, weight=1)
    view.master.columnconfigure(0, weight=1)
    
    if vert:
        scroll = Scrollbar(view.master, orient=tkinter.VERTICAL,
            command=view.yview)
        scroll.grid(row=0, column=1, sticky=(tkinter.W, tkinter.NS))
        view.configure(yscrollcommand=scroll.set)
    if horiz:
        scroll = Scrollbar(view.master, orient=tkinter.HORIZONTAL,
            command=view.xview)
        scroll.grid(row=1, column=0, sticky=(tkinter.N, tkinter.EW))
        view.configure(xscrollcommand=scroll.set)
    if resize:
        resize = Sizegrip(view.master)
        resize.grid(row=1, column=1, sticky=(tkinter.EW, tkinter.NS))
开发者ID:vadmium,项目名称:python-lib,代码行数:29,代码来源:tkwrap.py


示例17: set

    def set(self, lo, hi):
        """
        Set scrollbar slider's end positions.

        @param lo: Low end position. A float value between 0.0 and 1.0.

        @param hi: High end position. A float value between 0.0 and 1.0.

        @return: None.
        """
        # If scrollbar slider's both ends reached extreme position
        if float(lo) <= 0.0 and float(hi) >= 1.0:
            # Hide the scrollbar
            self.grid_remove()

        # If not scrollbar slider's both ends reached extreme position
        else:
            # Show the scrollbar
            self.grid()

        # Call super version
        Scrollbar.set(self, lo, hi)
开发者ID:AoiKuiyuyou,项目名称:AoikRegistryEditor,代码行数:22,代码来源:text.py


示例18: __init__

        def __init__(self, parent, *args, **kw):
            Frame.__init__(self, parent, *args, **kw)

            # create a canvas object and a vertical scrollbar for scrolling it
            vscrollbar = Scrollbar(self, orient=VERTICAL)
            vscrollbar.pack(fill=Y, side=RIGHT, expand=False)
            self.canvas = canvas = StyledCanvas(
                self, bd=0, highlightthickness=0,
                yscrollcommand=vscrollbar.set)
            canvas.pack(side=LEFT, fill=BOTH, expand=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 = Frame(canvas)
            interior_id = canvas.create_window(0, 0, window=interior,
                                               anchor=N+W)

            # track changes to the canvas and frame width and sync them,
            # also updating the scrollbar
            def _configure_interior(event):
                # update the scrollbars to match the size of the inner frame
                size = (interior.winfo_reqwidth(), interior.winfo_reqheight())
                canvas.config(scrollregion="0 0 %s %s" % size)
                if interior.winfo_reqwidth() != canvas.winfo_width():
                    # update the canvas's width to fit the inner frame
                    canvas.config(width=interior.winfo_reqwidth())
            interior.bind('<Configure>', _configure_interior)

            def _configure_canvas(event):
                if interior.winfo_reqwidth() != canvas.winfo_width():
                   # update the inner frame's width to fill the canvas
                    canvas.itemconfigure(interior_id,
                                         width=canvas.winfo_width())
            canvas.bind('<Configure>', _configure_canvas)
            MouseWheel(self).add_scrolling(canvas, yscrollbar=vscrollbar)
开发者ID:nishimaomaoxiong,项目名称:pyDEA,代码行数:39,代码来源:scrollable_frame_gui.py


示例19: create_widgets

    def create_widgets(self):
        ''' Creates all widgets.
        '''
        self.grid_rowconfigure(0, weight=1)
        self.grid_columnconfigure(0, weight=1)

        xscrollbar = Scrollbar(self, orient=HORIZONTAL)
        xscrollbar.grid(row=1, column=0, sticky=E+W)

        yscrollbar = Scrollbar(self)
        yscrollbar.grid(row=0, column=1, sticky=N+S)

        self.text = Text(self, wrap=NONE,
                         xscrollcommand=xscrollbar.set,
                         yscrollcommand=yscrollbar.set)

        self.text.bind("<Control-Key-a>", self.select_all)
        self.text.bind("<Control-Key-A>", self.select_all)

        self.text.grid(row=0, column=0, sticky=N+S+E+W)

        xscrollbar.config(command=self.text.xview)
        yscrollbar.config(command=self.text.yview)
开发者ID:nishimaomaoxiong,项目名称:pyDEA,代码行数:23,代码来源:text_frame_gui.py


示例20: workflow

    def workflow(self):
        PL=self.Pipeline.get() #pipelineget()
        gf=Toplevel()
        #MkaS=os.popen("./makeasnake.py 2>&1 | tee -a "+workpath.get()+"/Reports/makeasnake.log").read()
    
        gf.title("CCBR Pipeliner: "+ PL + " Workflow Graph")
        cgf = Canvas(gf,bg="white")
        #gff=Frame(cgf,width=300,height=300)
        xscrollbar = Scrollbar(gf, orient=HORIZONTAL)
        xscrollbar.pack(side = BOTTOM, fill=X )
        xscrollbar.config(command=cgf.xview)

        yscrollbar = Scrollbar(gf,orient=VERTICAL)
        yscrollbar.pack(side = RIGHT, fill=Y )
        yscrollbar.config(command=cgf.yview)

        cgf.config(xscrollcommand=xscrollbar.set, yscrollcommand=yscrollbar.set)
        cgf.config(width=600,height=600)
        cgf.pack(expand=1,fill=BOTH,side=RIGHT)
        cgf.config(scrollregion=(0,0,5000,20000))
        img = PhotoImage(file=self.workpath.get()+"/Reports/"+PL+".gif")
        cgf.create_image(0,0,image=img, anchor="nw")
        cgf.image=img
开发者ID:felloumi,项目名称:Pipeliner,代码行数:23,代码来源:frame.py



注:本文中的tkinter.ttk.Scrollbar类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python ttk.Style类代码示例发布时间:2022-05-27
下一篇:
Python ttk.Label类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap