当前位置: 首页>>代码示例>>Python>>正文


Python Treeview.bind方法代码示例

本文整理汇总了Python中ttk.Treeview.bind方法的典型用法代码示例。如果您正苦于以下问题:Python Treeview.bind方法的具体用法?Python Treeview.bind怎么用?Python Treeview.bind使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ttk.Treeview的用法示例。


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

示例1: __init__

# 需要导入模块: from ttk import Treeview [as 别名]
# 或者: from ttk.Treeview import bind [as 别名]
class Display:
    def __init__(self, controller):
        self.controller = controller

        self.currIndex = 0

        # initialize the GUI
        self.app = Tk()
        self.app.title('Jack Magee\'s Pub')

        self.tree = Treeview(self.app, height=30)
        
        # name the tree columns, not sure if they have to be named numbers but that's how the example did it
        self.tree["columns"]=("one", "two", "three", "four")
        
        # set the column widths
        self.tree.column("one", width=200)
        self.tree.column("two", width=300)
        self.tree.column("three", width=200)
        self.tree.column("four", width=200)

        # set the column headings
        self.tree.heading("#0", text= "ID")
        self.tree.heading("one", text="Name")
        self.tree.heading("two", text="Order")
        self.tree.heading("three", text="Price")
        self.tree.heading("four", text="Respond (double-click)")

        self.tree.pack()
        
        # register handler for double-clicks
        self.tree.bind("<Double-1>", self.OnDoubleClick)

    def mainloop(self):
        self.app.mainloop()

    # this is like making tree entries buttons
    def OnDoubleClick(self, event):
        # get the pressed item
        item = self.tree.selection()[0]
        # get the item's text
        response =  self.tree.item(item,"text")

        # this is the only response we are sending for now
        if response == 'rdy':
            # get the parent directory whose text is the customer id
            parent = self.tree.parent(item)
            customer_id = self.tree.item(parent,"text")
            # remove it from the tree
            self.tree.delete(parent)
            # send the message to the customer
            self.controller.send_msg(customer_id, response)

    # add a new order to the tree
    def takeOrder(self, customer_id, name, order, price):
        # just a row identifier
        thisRow = str(self.currIndex)

        # insert the i.d. and name at the top level
        self.tree.insert("", self.currIndex, thisRow, text=customer_id, values=(name, "", "", ""))
        # insert the "button" for sending notification to clients
        self.tree.insert(thisRow, 0, text='rdy', values=("", "", "", "Ready For Pick Up"))

        # this is a hacky solution to get multiline orders to appear because treeviews will 
        # crop anything more than 1 line so I just make a new entry for every line
        multiline_order = order.split('\n')
        this_line = 1
        for line in multiline_order[:-1]:   # exclude the last end line
            if this_line == 1:  # the first line has the name of the order and it's price
                self.tree.insert(thisRow, 1, text="order",values=("", order, price, ""))
            else: # just keep printing the extra options, sides, and add ons
                self.tree.insert(thisRow, this_line, text="order",values=("", line, "", ""))
            this_line += 1

        self.currIndex += 1
开发者ID:dnav6987,项目名称:PubApp,代码行数:77,代码来源:GUI.py

示例2: WaitingRoom

# 需要导入模块: from ttk import Treeview [as 别名]
# 或者: from ttk.Treeview import bind [as 别名]
class WaitingRoom(cll.ClientListener, object): #Note: extending cll.ClientListener if Gui does not extend WaitingRoom
    def __init__(self):
        self.Names = []
        self.tree_headers = ['Player','Status','Address','Game','Color']
        self.quit = False   #quit program after wroom has been closed. it will be passed to Gui.quit

    def startWaitingRoomUI(self, pumpit):
        self.pumpit = True
        if 'pumpit' in locals():
            self.pumpit = pumpit
        cfg.wroom = Tk()
        cfg.wroom.protocol("WM_DELETE_WINDOW", self.quitWaitingRoom)

        """State variables - By using textvariable=var in definition widget is tied to this variable"""
        statusmsg_sv = StringVar() #needed
        entry_sv = StringVar(value = cfg.name)
        #entry_sv.trace("w", lambda name, index, mode, sv=entry_sv: self.changeName(sv))
        chatentry_sv = StringVar(value = "Press enter to chat")

        """Create and grid the outer content frame"""
        content = ttk.Frame(cfg.wroom) #, padding=(5, 5, 12, 0)) 		#Frame in cfg.wroom
        content.grid(column = 0, row = 0, sticky = (N,W,E,S))
        cfg.wroom.grid_columnconfigure(0, weight = 1)
        cfg.wroom.grid_rowconfigure(0, weight = 1)

        """Create the different widgets; note the variables that some widgets are bound to"""
        self.tree = Treeview(content, show="headings", columns=cfg.wroominstance.tree_headers, name = "treeview")
        self.tree.column("#1", minwidth = 100, width = 120, stretch = NO)
        self.tree.column("#2", minwidth = 30, width = 60, stretch = NO)
        self.tree.column("#3", minwidth = 30, width = 50, stretch = YES)
        self.tree.column("#4", minwidth = 30, width = 50, stretch = YES)
        self.tree.column("#5", minwidth = 30, width = 50, stretch = YES)
        namelbl = ttk.Label(content, text="Player name")
        self.nameentry = ttk.Entry(content, bg = 'white', textvariable = entry_sv, name = "nameentry")#, validatecommand=validateIt)
        colorlbl = ttk.Label(content, text="Player color")
        self.colorframe = ttk.Frame(content, name = "colorframe", borderwidth = 1, relief='sunken')
        lbl = ttk.Label(content, text="Send to player:")	#Label on the right
        self.log = Listbox(content, height = 5, bg = 'white', name = "logbox")#, listvariable=cmessagelog		#Listbox with messages
        self.chatAll = ttk.Button(content, text = 'Chat to All', command = self.chatToAll, default = 'active', width = '6',name = "chat")
        self.chatentry = ttk.Entry(content, bg = 'white', foreground = 'gray', textvariable = chatentry_sv, name = "chatentry", selectforeground = 'blue')
        testbtn = ttk.Button(content, text = 'Connections', command = self.test, default = 'active', width = '6', name = "testbtn")
        ready = ttk.Button(content, text = 'Ready', command = self.toggleReadyForGame, default = 'active', width = '6', name = "readybtn")
        solitaire = ttk.Button(content, text = 'Solitaire', command = self.solitaire, default = 'active', width = '6', name = "solitairebtn")
        quit = ttk.Button(content, text = 'Quit', command = self.quitWaitingRoom, default = 'active', width = '6', name = "quitbtn")
        status = ttk.Label(content, textvariable = statusmsg_sv, anchor = W, name = "statuslbl") #Label on the bottom

        def get_tree():
            """Get from the self.tree an item when clicked"""
            idxs = self.tree.item(self.tree.focus())
            vals = idxs['values']
            if len(idxs['values'])==0: return None
            return vals
        """def sortby(tree, col, descending):
            Sort tree contents when a column header is clicked on
            # grab values to sort
            data = [(tree.set(child, col), child) \
                for child in tree.get_children('')]
            # now sort the data in place
            data.sort(reverse=descending)
            for ix, item in enumerate(data):
                tree.move(item[1], '', ix)
            # switch the heading so it will sort in the opposite direction
            tree.heading(col, command=lambda col=col: sortby(tree, col, int(not descending)))
        """
        def showstatus(*args):
            """Called when the selection in the listbox changes;
            Update the status message on the bottom with the new information"""
            list = get_tree()
            if list is None:
                return
            statusmsg_sv.set("Player %s has this status: %s" % (list[0], list[1]))

        # Grid all the widgets
        self.tree.grid(row = 0, column = 0, rowspan = 9, sticky = (N,S,E,W))
        namelbl.grid(row = 0, column = 1, columnspan = 2, sticky = (N,W), padx = 5)
        self.nameentry.grid(row = 1, column = 1, columnspan = 2, sticky = (N,E,W), pady = 5, padx = 5)
        colorlbl.grid(row = 0, column = 3, columnspan = 1, sticky = (N,W), padx = 5)
        self.colorframe.grid(row = 1, column = 3, columnspan = 1, sticky = (N,E,W), pady = 5, padx = 5)
        #testbtn.grid(row = 3, column = 3, columnspan = 1, sticky = E, padx = 5)		#Test Button
        self.log.grid(row = 5, column = 1, columnspan = 3, sticky = (N,S,E,W), padx = 5, pady = 5)   #Listbox with all messages
        self.chatentry.grid(row = 6, column = 1, columnspan = 2, sticky = (N,E), padx = 5, pady = 5)
        self.chatAll.grid(row = 6, column = 3, columnspan = 1, sticky = (N,E), padx = 5, pady = 5)
        ready.grid(row = 7, column = 1, sticky = (W,S), padx = 5, pady = 5)			#
        solitaire.grid(row = 7, column = 2, sticky = (W,S), padx = 5, pady = 5)
        quit.grid(row = 7, column = 3, sticky = (W,S), padx = 5, pady = 5)
        status.grid(row = 9, column = 0, columnspan = 2, sticky = (W,E))

        """Configure content Frame and color Frame"""
        content.grid_columnconfigure(0, weight = 1)
        content.grid_rowconfigure(5, weight = 1)
        h = self.nameentry.winfo_reqheight()
        self.colorframe.configure(height = h, bg = 'red')

        """Set event bindings"""
        self.tree.bind('<<TreeviewSelect>>', showstatus)
        self.nameentry.bind('<Return>', (lambda _: self.askChangeName(self.nameentry)))
        self.nameentry.bind('<FocusOut>', (lambda _: self.askChangeName(self.nameentry)))
        cfg.wroom.bind('<Control-Key-w>', self.quitWaitingRoom)
        cfg.wroom.bind('<Control-Key-q>', self.quitWaitingRoom)
        cfg.wroom.bind('<Control-Key-r>', self.toggleReadyForGame)
#.........这里部分代码省略.........
开发者ID:aless80,项目名称:tantrix,代码行数:103,代码来源:waitingRoom.py

示例3: Multicolumn_Listbox

# 需要导入模块: from ttk import Treeview [as 别名]
# 或者: from ttk.Treeview import bind [as 别名]

#.........这里部分代码省略.........
        s.configure(style_name, **style_config)

        heading_style_config = {}
        if heading_font is not None:
            heading_style_config["font"] = heading_font
        if heading_background is not None:
            heading_style_config["background"] = heading_background
        if heading_foreground is not None:
            heading_style_config["foreground"] = heading_foreground

        heading_style_name = style_name + ".Heading"
        s.configure(heading_style_name, **heading_style_config)

        treeview_kwargs = {"style": style_name}

        if height is not None:
            treeview_kwargs["height"] = height
            
        if padding is not None:
            treeview_kwargs["padding"] = padding
            
        if headers:
            treeview_kwargs["show"] = "headings"
        else:
            treeview_kwargs["show"] = ""
        
        if select_mode is not None:
            treeview_kwargs["selectmode"] = select_mode

        self.interior = Treeview(master, columns=columns, **treeview_kwargs)
        
        if command is not None:
            self._command = command
            self.interior.bind("<<TreeviewSelect>>", self._on_select)

        for i in range(0, self._number_of_columns):

            if sort:
                self.interior.heading(i, text=columns[i], anchor=heading_anchor, command=lambda col=i: self.sort_by(col, descending=False))
            else:
                self.interior.heading(i, text=columns[i], anchor=heading_anchor)
                
            if adjust_heading_to_content:
                self.interior.column(i, width=Font().measure(columns[i]))

            self.interior.column(i, anchor=cell_anchor)
            
        if data is not None:
            for row in data:
                self.insert_row(row)

    @property
    def row_height(self):
        return self._rowheight
        
    @property
    def font(self):
        return self._cell_font

    def configure_column(self, index, width=None, minwidth=None, anchor=None, stretch=None):
        kwargs = {}
        for config_name in ("width", "anchor", "stretch", "minwidth"):
            config_value = locals()[config_name]
            if config_value is not None:
                kwargs[config_name] = config_value
            
开发者ID:jacob-carrier,项目名称:code,代码行数:69,代码来源:recipe-580746.py

示例4: CommSearch

# 需要导入模块: from ttk import Treeview [as 别名]
# 或者: from ttk.Treeview import bind [as 别名]
class CommSearch(Frame):
  
    def __init__(self, parent):
        Frame.__init__(self, parent)   
         
        self.parent = parent        
        self.initUI()
        
    def initUI(self):

        self.entries_found = []

        self.parent.title("Search your command cards")
        self.style = Style()
        self.style.theme_use("default")        
        self.pack()
        
        self.input_title = Label(self, text="Enter your command below")
        self.input_title.grid(row=0, columnspan=2)
        self.input_box = Entry(self, width=90)
        self.input_box.grid(row=1, column=0)
        self.input_box.focus()
        self.input_box.bind("<Key>", self.onUpdateSearch)
        self.search_btn = Button(self, text="Search", command=self.onSearch)
        self.search_btn.grid(row=1, column=1)
        self.output_box = Treeview(self, columns=("Example"))
        ysb = Scrollbar(self, orient='vertical', command=self.output_box.yview)
        xsb = Scrollbar(self, orient='horizontal', command=self.output_box.xview)
        self.output_box.configure(yscroll=ysb.set, xscroll=xsb.set)
        self.output_box.heading('Example', text='Example', anchor='w')
        self.output_box.column("#0",minwidth=0,width=0, stretch=NO)
        self.output_box.column("Example",minwidth=0,width=785)
        self.output_box.bind("<Button-1>", self.OnEntryClick)
        self.output_box.grid(row=3, columnspan=2)
        self.selected_box = Text(self, width=110, height=19)
        self.selected_box.grid(row=4, columnspan=2)
        self.gotoadd_btn = Button(self, text="Go to Add", command=self.onGoToAdd)
        self.gotoadd_btn.grid(row=5)

    def OnEntryClick(self, event):
        try:
            item = self.output_box.selection()[0]
        except IndexError:
            pass
        entry_title = self.output_box.item(item,"value")
        for item in self.entries_found:
            if str(entry_title) == str("('" + item.title.strip('\n') + "',)"):
                self.selected_box.delete(0.1, END)
                self.selected_box.insert(END, item.text + '\n')

    def onUpdateSearch(self, key):
    # Somehow calling self.onSearch() does not register last key
    # And we need to correct "special chars"
        global entries, entries_map
        text_entries = ""
        for item in self.output_box.get_children():
            self.output_box.delete(item)		
    # ...like, for instance, deleting last character
        if key.char == '\b':
            search_terms = str(self.input_box.get()[:-1])
        else: 
            search_terms = str(self.input_box.get() + key.char)
        self.entries_found = []
        self.entries_found = data.Search(search_terms,entries,entries_map)
        for item in range(len(self.entries_found)):
            aux = self.output_box.insert('', 'end', '', value=[self.entries_found[item].title.split('\n')[0]])

			
    def onSearch(self):
        global entries, entries_map
        text_entries = ""
        for item in self.output_box.get_children():
            self.output_box.delete(item)
        search_terms = str(self.input_box.get())
        for item in data.Search(search_terms,entries,entries_map):
            self.output_box.insert('', 'end', '', value=[self.entries_found[item].title.split('\n')[0]])
			
    def onGoToAdd(self):
        newroot = Tk()
        newcomm = CommAdd(newroot)
        newroot.geometry("800x600+0+0")
        newroot.mainloop()
开发者ID:angelalonso,项目名称:comm,代码行数:84,代码来源:comm.py

示例5: XML_Viwer

# 需要导入模块: from ttk import Treeview [as 别名]
# 或者: from ttk.Treeview import bind [as 别名]
class XML_Viwer(Frame):

    def __init__(self, master, xml=None, heading_text=None, heading_anchor=None, padding=None, cursor=None, takefocus=None, style=None):
        Frame.__init__(self, master, class_="XML_Viwer")

        self._vsb = Scrollbar(self, orient=VERTICAL)
        self._hsb = Scrollbar(self, orient=HORIZONTAL)

        kwargs = {}
        kwargs["yscrollcommand"] = lambda f, l: autoscroll(self._vsb, f, l)
        kwargs["xscrollcommand"] = lambda f, l: autoscroll(self._hsb, f, l)
       
        if style is not None:
            kwargs["style"] = style
            
        if padding is not None:
            kwargs["padding"] = padding
            
        if cursor is not None:
            kwargs["cursor"] = cursor
            
        if takefocus is not None:
            kwargs["takefocus"] = takefocus

        self._treeview = Treeview(self, **kwargs)
        
        if heading_text is not None:
            if heading_anchor is not None:
                self._treeview.heading("#0", text=heading_text, anchor=heading_anchor)
            else:
                self._treeview.heading("#0", text=heading_text)

        self._treeview.bind("<<TreeviewOpen>>", self._on_open)
        self._treeview.bind("<<TreeviewClose>>", self._on_close)
        
        # Without this line, horizontal scrolling doesn't work properly.
        self._treeview.column("#0", stretch= False)

        self._vsb['command'] = self._treeview.yview
        self._hsb['command'] = self._treeview.xview

        self._treeview.grid(column=0, row=0, sticky=N+S+W+E)
        self._vsb.grid(column=1, row=0, sticky=N+S)
        self._hsb.grid(column=0, row=1, sticky=E+W)
        
        self.grid_columnconfigure(0, weight=1)
        self.grid_rowconfigure(0, weight=1)

        self._element_tree = None
        self._item_ID_to_element = {}

        if xml is not None:
            self.parse_xml(xml)

    def _on_open(self, event):
        item_ID = self._treeview.focus()
        if item_ID not in self._item_ID_to_element: return

        node = self._item_ID_to_element[item_ID]

        self._treeview.item(item_ID, text = self._repr_of_openning_tag(node))
        
    def _on_close(self, event):
        item_ID = self._treeview.focus()
        if item_ID not in self._item_ID_to_element: return

        node = self._item_ID_to_element[item_ID]
        
        text = self._repr_of_openning_tag(node) + self._repr_of_closing_tag(node)
        self._treeview.item(item_ID, text = text)

    def parse_xml(self, xml):
        self._element_tree = ET.ElementTree(ET.fromstring(xml))
        
        self.clear()
        self._walk_xml(self._element_tree.getroot())
        
    @property
    def element_tree(self):
        return self._element_tree
    
    @element_tree.setter
    def element_tree(self, element_tree):
        self._element_tree = element_tree
        
        self.clear()
        self._walk_xml(element_tree.getroot())   
        
    def clear(self):
        self._item_ID_to_element = {}
        self._treeview.delete(*self._treeview.get_children())
        
    def _repr_of_openning_tag(self, node):
        text = "<" + node.tag

        attrs = node.attrib
        
        # list function is here necessary to provide support to Python 3
        a_names = list(attrs.keys())
        a_names.sort()
#.........这里部分代码省略.........
开发者ID:jacob-carrier,项目名称:code,代码行数:103,代码来源:recipe-580752.py

示例6: __init__

# 需要导入模块: from ttk import Treeview [as 别名]
# 或者: from ttk.Treeview import bind [as 别名]
class SDCard: 
	def __init__(self, root, prtr, settings, log):
		self.app = root
		self.printer = prtr
		self.settings = settings
		self.log = log
		self.top = None

	def isActive(self):
		return self.top != None

	def start(self):
		self.app.sdchecking = True
		self.printer.send_now("M21")
		
	def sdCheckComplete(self, ready):
		if not ready:
			self.log.logMsg("Error initializing SD card")
		else:
			self.app.sdlisting = True
			self.printer.send_now("M20")
			
	def refresh(self):
		self.top.destroy()
		self.app.sdlisting = True
		self.printer.send_now("M20")
			
	def sdListComplete(self, sdlist):
		top = self.top = Toplevel(self.app) 
		top.title("SD Card Control")
		top.protocol('WM_DELETE_WINDOW', self.delTop)
		f = Frame(top, height=150, width=150)
		f.grid(row=1, column=1);
		self.tree = Treeview(f, height=12, selectmode='browse') 
		self.tree.column("#0", minwidth=100)
		self.tree.bind("<<TreeviewSelect>>", self.treeSelect)
		self.sb = Scrollbar(f)
		self.sb.config(command=self.tree.yview)
		self.tree.config(yscrollcommand=self.sb.set)
			
		self.sb.pack(side=RIGHT, fill=Y)
		self.tree.pack(side=LEFT, fill=BOTH, expand=1)

		SDroot = SDDir('')
		for item in sdlist:
			if item.startswith('/'):
				cd = SDroot
				l = item[1:].split('/')
				for d in l[:-1]:
					ncd = cd.getDir(d)
					if ncd == None:
						ncd = cd.addDir(d)
			
					cd = ncd
				cd.addFile(l[-1], fqn=item)
					
			else:
				SDroot.addFile(item)
				
		SDroot.sortAll()
		
		self.fileMap = {}
		self.startFile = None
		self.loadDir(SDroot, '')
		bf = Frame(top, width=50)
		bf.grid(column=3, row=1)
		
		blf = LabelFrame(bf, text="Print from SD Card", width=48, height=40)
		
		self.bPrint = Button(blf, text='Print', command=self.doPrint, width = 6) 
		self.bPrint.pack()
		blf.pack(fill='x')
		
		blf = LabelFrame(bf, text="Delete from SD Card", width=48, height=40)
		
		self.bDelete = Button(blf, text="Delete", command=self.doDelete, width=6)
		self.bDelete.pack()
		blf.pack(fill='x')
		
		blf = LabelFrame(bf, text="Upload to SD Card", width=48, height=180)

		self.upDir = Label(blf, text="Dir:", justify=LEFT)
		self.upDir.pack()

		ef = Frame(blf)

		l = Label(ef, text="File:", justify=LEFT)
		l.pack(side=LEFT)

		self.entry = Entry(ef, width=12)
		self.entry.pack(side=LEFT)
		fn = 'untitled.g'
		if self.app.GCodeFile:
			fn = os.path.basename(self.app.GCodeFile)
			if len(fn) > 8:
				fn = fn[0:8]
			fn += ".g"
		self.entry.delete(0, END)
		self.entry.insert(0, fn)
		ef.pack()
#.........这里部分代码省略.........
开发者ID:jbernardis,项目名称:repraphost,代码行数:103,代码来源:sdcard.py

示例7: __init__

# 需要导入模块: from ttk import Treeview [as 别名]
# 或者: from ttk.Treeview import bind [as 别名]
        def __init__(self, parent, controller):
			Frame.__init__(self, parent)
			
			#INSTANCIAS
			global cc, nombre, pago, ref, cod, desc, valor, resultado, total, tiempo, mes, anio, fechapago
			#INSTANCIAS DE LOS WIDGETS
			global e1, e2, e3, e4, e5, tree, l8, lb
			
			cc = IntVar()
			nombre = StringVar()
			pago = StringVar()
			ref = StringVar()
			cod = StringVar()
			desc = StringVar()
			valor = DoubleVar()
			
			tiempo = datetime.date.today()
			anio = time.strftime("%Y")
			mes = time.strftime("%B")
			fechapago = StringVar()
			
			total = 0.0
			resultado = DoubleVar()
			
			tbancos = ['Bancolombia', "Banco Bogotá", "Banco Agrario", "Banco Occidente"]
			
			lupa = PhotoImage(file='img/lupa.png')
			
			tbanktype = ['Corriente','Ahorro']
			fpago = ['Efectivo','Transferencia']
			
			#BUSQUEDA = ["Nombre","CC/Nit"]
			busqueda = StringVar()
			busqueda.trace("w", lambda name, index, mode: buscar())
			dato = StringVar()
			
			#WIDGETS
			
			#========================= HEADER ==============================
			
			self.titleL = Label(self, text="GASTOS", font="bold")
			self.titleL.pack(pady=20, side=TOP)
			
			#========================== WRAPPER ============================
			
			self.wrapper = Frame (self)
			self.wrapper.pack(side=LEFT, fill=Y)
			#Esto centro el wrapper
			#self.wrapper.pack(side=LEFT, fill=BOTH, expand=True)
			
			#======================== BENEFICIARIO =======================
			
			self.lf1 = LabelFrame(self.wrapper, text="Beneficiario")
			self.lf1.pack(fill=X, ipady=5)
			
			self.f0 = Frame(self.lf1)
			self.f0.pack(pady=5, fill=X)#-----------------------------------
			
			l1 = Label(self.f0, text='CC/Nit:')
			l1.pack(side=LEFT)
			
			e1 = Entry(self.f0, textvariable=cc)
			e1.pack(side=LEFT)
			e1.bind('<Return>', buscarB)
			
			b0 = Button(self.f0, text='Buscar:', image=lupa, command=topBeneficiarios)
			b0.pack(side=LEFT)
			
			l2 = Label(self.f0, text='Nombre:')
			l2.pack(side=LEFT)
			e2 = Entry(self.f0, textvariable=nombre)
			e2.pack(side=LEFT, fill=X, expand=1)
			
			self.f1 = Frame(self.lf1)
			self.f1.pack(pady=5, fill=X)#-----------------------------------
			
			l3 = Label(self.f1, text='Forma de Pago:')
			l3.pack(side=LEFT)
			Cbx = Combobox(self.f1, textvariable=pago, values=fpago, width=15)
			Cbx.set('Efectivo')
			Cbx.pack(side=LEFT)
			
			l4 = Label(self.f1, text='Ref. Bancaria:')
			l4.pack(side=LEFT)
			e3 = Entry(self.f1, textvariable=ref)
			e3.pack(side=LEFT, fill=X, expand=1)
			
			b1 = Button(self.f1, text='Buscar:', image=lupa)
			b1.image=lupa
			b1.pack(side=LEFT)
			
			#======================== CONCEPTO ========================
			
			self.lf2 = LabelFrame(self.wrapper, text="Concepto")
			self.lf2.pack(fill=X, ipady=5)
			
			self.f2 = Frame(self.lf2)
			self.f2.pack(pady=5, fill=X)#-------------------------------
			
			l5 = Label(self.f2, text='Código:')
#.........这里部分代码省略.........
开发者ID:einnerlink,项目名称:sbienes,代码行数:103,代码来源:gastos.py

示例8: _add_frames

# 需要导入模块: from ttk import Treeview [as 别名]
# 或者: from ttk.Treeview import bind [as 别名]
    def _add_frames(self):
        # Adding Answer Backup Frame
        f1 = Frame(self)
        f1.grid(column=0, row=0, sticky="NWES")
        for i in range(4):
            f1.grid_rowconfigure(i, weight=0, pad=5)
        f1.grid_rowconfigure(4, weight=1, pad=5)
        for i in range(4):
            f1.grid_columnconfigure(i, weight=1, pad=5)

        Label(f1, anchor="e", text="Answers Count : ").grid(column=0, row=0, sticky="EWNS")
        self.answer_count = StringVar(value=len(self.crawler.answer_list))
        Label(f1, anchor="w", textvariable=self.answer_count).grid(column=1, row=0, sticky="EWNS")
        Label(f1, anchor="e", text="User Name : ").grid(column=2, row=0, sticky="EWNS")
        self.user = StringVar(value="Unknown")
        Label(f1, anchor="w", textvariable=self.user).grid(column=3, row=0, sticky="EWNS")

        tf_col = "#e6e6e6"
        tf = Tkinter.Frame(f1, relief=GROOVE, borderwidth="2p")
        tf.grid(row=1, columnspan=2, column=0, sticky="EWNS")
        Label(tf, text="Quora User Options", bg=tf_col, anchor="c").grid(column=0, row=0, columnspan=2, sticky="EWNS")
        Button(tf, text="Login", command=lambda: self.thread("login"), highlightbackground=tf_col).grid(
            column=0, row=1, sticky="EWNS"
        )
        Button(tf, text="Logout", command=lambda: self.thread("logout"), highlightbackground=tf_col).grid(
            column=1, row=1, sticky="EWNS"
        )
        tf.grid_rowconfigure(0, weight=1, pad=5)
        tf.grid_rowconfigure(1, weight=1, pad=5)
        tf.grid_columnconfigure(0, weight=1, pad=5)
        tf.grid_columnconfigure(1, weight=1, pad=5)

        tf = Frame(f1, relief=GROOVE, borderwidth="2p")
        tf.grid(row=1, columnspan=2, column=2, sticky="EWNS")
        Label(tf, text="Answer List Option", bg=tf_col, anchor="c").grid(column=0, columnspan=2, row=0, sticky="EWNS")
        Button(tf, text="Reset", command=lambda: self.thread("reset"), highlightbackground=tf_col).grid(
            column=0, row=1, sticky="EWNS"
        )
        Button(tf, text="Update", command=lambda: self.thread("update"), highlightbackground=tf_col).grid(
            column=1, row=1, sticky="EWNS"
        )
        tf.grid_rowconfigure(0, weight=1, pad=5)
        tf.grid_rowconfigure(1, weight=1, pad=5)
        tf.grid_columnconfigure(0, weight=1, pad=5)
        tf.grid_columnconfigure(1, weight=1, pad=5)

        # Add Progress Bar
        self.backup_progress = Progressbar(f1, orient="horizontal", length=100, mode="determinate")
        self.backup_progress.grid(row=2, columnspan=4, column=0, sticky="EWNS")

        # Adding Status Pane
        self.backup_status = StringVar(value="Ready")
        Label(f1, textvariable=self.backup_status, anchor="w").grid(row=3, column=0, columnspan=4, sticky="EWNS")

        # Adding The list of all answers
        tree = Treeview(f1, columns=("sno", "date", "question"))
        tree.heading("sno", text="S. No")
        tree.heading("date", text="Date")
        tree.heading("question", text="Question")

        tree.column("#0", width=0, stretch=False)
        tree.column("sno", width=40, stretch=False, anchor="center")
        tree.column("date", width=120, stretch=False, anchor="center")
        tree.column("question", stretch=True, anchor="w")
        tree.grid(column=0, columnspan=4, row=4, sticky="EWNS")
        tree.bind("<Double-1>", self.tree_item_click)
        self.answer_tree = tree
        self.populate_tree()

        f2 = Frame(self)
        self.add(f1, text="Answer Backup", underline=7)
        self.add(f2, text="Analytics")
开发者ID:Alafazam,项目名称:quora-analytics,代码行数:74,代码来源:main.py

示例9: ProjectVenster

# 需要导入模块: from ttk import Treeview [as 别名]
# 或者: from ttk.Treeview import bind [as 别名]
class ProjectVenster (ZoekVenster):

    TITLE = 'Projecten'

    def fill(self):
        super(self.__class__, self).fill()
        #Basisvelden
        self.identry = EntryField(self.veldenFrame, 'Projectnummer', row=0)
        self.naamentry = EntryField(self.veldenFrame, 'Projectnaam', row=1)
        self.jaarentry = EntryField(self.veldenFrame, 'Jaar', row=2)
        self.budgetentry = EntryField(self.veldenFrame, 'Budget', row=3)
        self.keywordLabel = Label(self.veldenFrame, text='Trefwoorden:')
        self.keywordLabel.grid(row=4, column=0, sticky=W)
        self.keywordText = Text(self.veldenFrame, relief=SUNKEN, wrap=WORD, width=60, height=3)
        self.keywordText.grid(row=4, column=1, sticky=W)

        #Partners
        self.partnersLabel = Label(self.veldenFrame, text='Relaties:')
        self.partnersLabel.grid(row=5, column=0)
        self.partnersFrame = Frame(self.veldenFrame)
        self.partnersFrame.grid(row=5, column=1, sticky=W+E)
        self.partnersListBox = Treeview(self.partnersFrame, columns=('Relatie', 'Rol'), height=3, show='headings', selectmode=BROWSE)
        self.partnersListBox.grid(row=0, column=0, sticky=W+E)

        self.partnersKnopFrame = Frame(self.veldenFrame)
        self.partnersKnopFrame.grid(row=6, column=1, sticky=E)
        self.pScrollbar = Scrollbar(self.partnersFrame)
        self.pScrollbar.grid(row=0, column=1, sticky=N+S+E)

        self.partnersListBox.config(yscrollcommand=self.pScrollbar.set)
        self.pScrollbar.config(command=self.partnersListBox.yview)

        self.partnersToevoegenKnop = Button(self.partnersKnopFrame, text='Toevoegen...', command=self.partnerToevoegen)
        self.partnersToevoegenKnop.grid()
        self.partnersVerwijderenKnop = Button (self.partnersKnopFrame, text='Verwijderen', command=self.partnerVerwijderen)
        self.partnersVerwijderenKnop.grid(row=0, column=1)
        self.partnersListBox.bind('<<TreeviewSelect>>', self.nieuwePartnerSelectie)

        #Bestanden
        self.bestandenHoofdFrame = Frame(self.resultaatframe)
        self.bestandenHoofdFrame.grid(row=2)
        self.bestandenLabel = Label(self.bestandenHoofdFrame, text='Bestanden:')
        self.bestandenLabel.grid(row=7, column=0, sticky=W)
        self.bestandenFrame = Frame(self.bestandenHoofdFrame)
        self.bestandenFrame.grid(row=7, column=1, sticky=W+E)
        self.bestandenListBox = Listbox(self.bestandenFrame, selectmode=EXTENDED, width=50, height=10)
        self.bestandenListBox.grid(row=0, column=0, sticky=W+E)
        self.bScrollbar = Scrollbar(self.bestandenFrame)
        self.bScrollbar.grid(row=0, column=1, sticky=N+S+E)
        self.bestandenListBox.config(yscrollcommand=self.bScrollbar.set)
        self.bScrollbar.config(command=self.bestandenListBox.yview)
        self.bestandenKnopFrame = Frame(self.bestandenHoofdFrame)
        self.bestandenKnopFrame.grid(row=8, column=1, sticky=E)
        self.bestandenToevoegKnop = Button(self.bestandenKnopFrame, text='Bestanden toevoegen...', command=self.bestandenToevoegen)
        self.bestandenToevoegKnop.grid(row=0, column=0, sticky=E)
        self.mapToevoegenKnop = Button(self.bestandenKnopFrame, text='Map toevoegen...', command=self.mapToevoegen)
        self.mapToevoegenKnop.grid(row=0, column=1, sticky=E)
        self.bestandenOphaalKnop = Button(self.bestandenKnopFrame, text='Ophalen...', command=self.bestandenOphalen)
        self.bestandenOphaalKnop.grid(row=0, column=2, sticky=E)
        self.bestandenVerwijderKnop = Button(self.bestandenKnopFrame, text='Verwijderen', command=self.bestandenVerwijderen)
        self.bestandenVerwijderKnop.grid(row=0, column=3, sticky=E)
        self.pollBestandenLijst()
        self.curid=-1


    def disableResultaat(self):
        self.identry.label.config(state=DISABLED)
        self.identry.entry.config(state=DISABLED)
        self.identry.setValue('')
        self.naamentry.label.config(state=DISABLED)
        self.naamentry.entry.config(state=DISABLED)
        self.naamentry.setValue('')
        self.jaarentry.label.config(state=DISABLED)
        self.jaarentry.entry.config(state=DISABLED)
        self.jaarentry.setValue('')
        self.budgetentry.label.config(state=DISABLED)
        self.budgetentry.entry.config(state=DISABLED)
        self.budgetentry.setValue('')
        self.keywordLabel.config(state=DISABLED)
        self.keywordText.delete(1.0, END)
        self.keywordText.config(state=DISABLED)
        self.partnersLabel.config(state=DISABLED)
        self.partnersListBox.delete(*self.partnersListBox.get_children())
        self.partnersToevoegenKnop.config(state=DISABLED)
        self.partnersVerwijderenKnop.config(state=DISABLED)
        self.bestandenLabel.config(state=DISABLED)
        self.bestandenListBox.delete(0, END)
        self.bestandenListBox.config(state=DISABLED)
        self.bestandenToevoegKnop.config(state=DISABLED)
        self.mapToevoegenKnop.config(state=DISABLED)
        self.bestandenOphaalKnop.config(state=DISABLED)
        self.bestandenVerwijderKnop.config(state=DISABLED)

    def enableResultaat(self):
        self.identry.label.config(state=NORMAL)
        self.identry.entry.config(state=NORMAL)
        self.naamentry.label.config(state=NORMAL)
        self.naamentry.entry.config(state=NORMAL)
        self.jaarentry.label.config(state=NORMAL)
        self.jaarentry.entry.config(state=NORMAL)
#.........这里部分代码省略.........
开发者ID:Lleuad,项目名称:PCMbv,代码行数:103,代码来源:projectvenster.py

示例10: GUIBuscador

# 需要导入模块: from ttk import Treeview [as 别名]
# 或者: from ttk.Treeview import bind [as 别名]
class GUIBuscador(Tk):

	def __init__(self, master = None):
		Tk.__init__(self, master)
		self.gui(master)
		self.dir = 'D:\Talker\Talker\Biblia'
		self.direc = glob("%s\*" % self.dir)

	def gui(self, master):
		self.frm = Frame(master)
		self.frm.pack(side = LEFT, expand = YES, fill = BOTH)
		self.left_side(self.frm)

		self.frm = Frame(master)
		self.frm.pack(side = RIGHT, expand = YES, fill = BOTH)
		self.right_side(self.frm)

	def left_side(self, master):
		self.nombre = Entry(master, justify = CENTER, bd = 3, font = ('Ravie', 11), textvariable = self.NameVar)
		self.nombre.pack(side = TOP, fill = X)
		self.nombre.bind("<Key>", self.Enter)
		self.texto = Entry(master, justify = CENTER, bd = 3, font = ('Ravie', 11), textvariable = self.TextVar)
		self.texto.pack(side = TOP, fill = X)
		self.texto.bind("<Key>", self.Enter)
		self.tag = Entry(master, justify = CENTER, bd = 3, font = ('Ravie', 11), textvariable = self.TagsVar)
		self.tag.pack(side = TOP, fill = X)
		self.tag.bind("<Key>", self.Enter)
		self.tree = Treeview(master)
		self.tree.pack(side = LEFT, expand = YES, fill = BOTH)
		self.tree.bind("<Double-1>", self.OnDoubleClick)

	def right_side(self, master):
		self.text = Text(master, bg = 'skyblue', bd = 5, 
					font = ('consolas', 12), fg = 'red')
		self.text.pack(expand = YES, side = LEFT, fill = BOTH)
		self.yscroller = Scrollbar(master, command = self.text.yview)
		self.yscroller.pack(side = RIGHT, fill = Y)
		self.text['yscrollcommand'] = self.yscroller

	def OnDoubleClick(self, tree):
		try:
			item = self.tree.selection()[0]
			self.tree.item.open(item)
		except IndexError:
			pass

	def Enter(self, event):
		if event.char == ord(13):
			self.buscar()

	def buscar(self):
		name = NameVar.get()
		text = TextVar().get()
		etiqueta = TagsVar.get().split(',')
		self.aciertos = []
		for carpeta in self.direc:
			root = tree.insert("", 1, name[-3], text = name[-3])
			self.aciertos = []
			for versiculo in glob("%s\*" % carpeta):
				with open(versiculo, 'r') as nota:
					texto = nota.readlines()
					etiquetas = texto[-1].split(',')
					if name != '':
						versiculo = versiculo.replace(".txt", "")
						if re.search('%s' % name, versiculo):
							pass
						else:
							continue
					if etiqueta != []:
						for i in etiquetas:
							if i in etiqueta:
								break
						else:
							continue
					if text != '':
						for line in texto:
							if re.search(r'%s' % text, line):
								break
						else:
							continue
					tree.insert(raiz, "end", name, text = name[-1])
					self.aciertos.append(versiculo)
			if self.aciertos == []:
				self.tree.delete(root)
开发者ID:ErmantrautJoel,项目名称:Python,代码行数:86,代码来源:Interfaz+Biblico.py

示例11: __init__

# 需要导入模块: from ttk import Treeview [as 别名]
# 或者: from ttk.Treeview import bind [as 别名]

#.........这里部分代码省略.........
		l.pack(side=LEFT)
		e9 = Entry(f3, textvariable=iva, state=DISABLED, width=12)
		e9.pack(side=LEFT,fill=X)
		
		l = Label(f3, text='Total ')
		l.pack(side=LEFT)
		e10 = Entry(f3, textvariable=total, state=DISABLED, width=12)
		e10.pack(side=LEFT,fill=X)
		
		f4 = Frame(wrap)
		f4.pack(pady=5,fill=X)#---------------------------
		
		#========================= FACTURACIÓN =========================
		
		self.lf1 = LabelFrame(self, text="Periodo a facturar")
		self.lf1.pack(anchor=W,pady=5,fill=X)#-------------------------

		self.f2 = Frame(self.lf1)
		self.f2.pack(pady=5,fill=X)#---------------------------

		self.mesiniL = Label(self.f2, text='Mes inicial:')
		self.mesiniL.pack(padx=5,side=LEFT)

		CbxVlr = Combobox(self.f2, textvariable=mes1, values=meses, width=10, state=DISABLED)
		CbxVlr.set(mes)
		CbxVlr.pack(side=LEFT)

		self.emptyL = Label(self.f2)###VACIO###
		self.emptyL.pack(padx=5, side=LEFT)
	
		self.yeariniL = Label(self.f2, text='Año:')
		self.yeariniL.pack(side=LEFT)
		self.yeariniE = Entry(self.f2, textvariable=fechapago, width=8, state=DISABLED)
		fechapago.set(anio)
		self.yeariniE.pack(side=LEFT)

		self.mesfinL = Label(self.f2, text='Mes final:')
		self.mesfinL.pack(padx=5,side=LEFT)

		self.mesfinCbx = Combobox(self.f2, textvariable=mes2, values=meses, width=10)
		self.mesfinCbx.set(mes)
		self.mesfinCbx.pack(side=LEFT)

		self.emptyL = Label(self.f2)###VACIO###
		self.emptyL.pack(padx=5, side=LEFT)

		self.yearfinL = Label(self.f2, text='Año:')
		self.yearfinL.pack(side=LEFT)
		self.yearfinE = Entry(self.f2, textvariable=fechapago, width=8)
		fechapago.set(anio)
		self.yearfinE.pack(side=LEFT)

		self.emptyL = Label(self.f2)###VACIO###
		self.emptyL.pack(padx=5, side=LEFT)
		
		pdfB = Button(self.f2, text="Facturar", command=agregar, state=DISABLED)
		pdfB.pack(side=LEFT)

		#========================== TREEVIEW ===========================
		
		self.f3 = Frame(self)
		self.f3.pack(pady=5,fill=X)#------------------------------------
		
		tree = Treeview(self.f3, height=4, show="headings", columns=('col1','col2'))
		tree.pack(side=LEFT, fill=X, expand=1)
		
		tree.column('col1', width=250, anchor='center')
		tree.column('col2', width=5, anchor='center')
		
		tree.heading('col1', text='Descripción')
		tree.heading('col2', text='Valor')
		
		scroll = Scrollbar(self.f3,orient=VERTICAL,command=tree.yview)
		tree.configure(yscrollcommand=scroll.set)
		tree.bind("<Delete>", borrar)
		
		#======================== OBSERVACIONES ========================

		self.f4 = Frame(self)
		self.f4.pack(pady=5,fill=X)#--------------------

		self.notesL = Label(self.f4, text='Observaciones:')
		self.notesL.pack(side=LEFT)

		self.f5 = Frame(self)
		self.f5.pack(pady=5,fill=X)#-------------------

		observaciones = Text(self.f5, height=5)
		observaciones.pack(fill=X, side=LEFT, expand=1)
		
		#=========================== BOTONES ===========================
		
		footer = Frame(self)
		footer.pack()#-------------------------------
		
		clean = Button(footer, text='Cancelar', bg='navy', foreground='white', activebackground='red3', activeforeground='white', command=cancelar)
		clean.pack(side=RIGHT)
		
		add = Button(footer, text='Grabar', bg='navy', foreground='white', activebackground='red3', activeforeground='white', command=grabar, state=DISABLED)
		add.pack(side=RIGHT)
开发者ID:einnerlink,项目名称:sbienes,代码行数:104,代码来源:factura_inquilino.py

示例12: pylasticGUI

# 需要导入模块: from ttk import Treeview [as 别名]
# 或者: from ttk.Treeview import bind [as 别名]
class pylasticGUI(Frame):
  
    def __init__(self):
        
        self.__fileName = 'POSCAR'
        self.__NoP = 11
        self.__strain = 0.05
        self.__executable = '/home/t.dengg/bin/vasp/vasp.5.3/vasp'
        self.__status = None
        self.__finished = None
        self.__paths = None
        self.__structuresinst = None
        self.__p1 = None
        self.__p2 = None
        self.__workdir = os.getcwd()
        Frame.__init__(self, name = 'pylastic')
        self.grid(row=0, column=0, sticky=NSEW)   
        #self.pack(expand=Y, fill=BOTH)
        self._create_panel()
            
        
    def _create_panel(self):
        
        panel = Frame(self, name='elastic')
        #panel.pack(side=TOP, fill=BOTH, expand=Y)
        panel.grid(row=0, column=0, sticky=NSEW) 
        nb = Notebook(panel, name='notebook')
        
        nb.enable_traversal()
        #nb.pack(fill=BOTH, expand=Y, padx=2, pady=3)
        nb.grid(row=0, column=0, sticky=NSEW)
        self._create_setup_tab(nb)
        self._create_analyze_tab(nb)
        
    def _create_setup_tab(self, nb):
        
        frame = Frame(nb, name='setup')
        
        self.e1 = Entry(frame, width=7)
        self.e1.bind()
        self.e1.grid(row=0, column=1)
        self.e1.delete(0, END)
        self.e1.insert(0, '21')
        
        self.label1 = Label(frame, text='Number of points:')
        self.label1.grid(row=0, column=0, sticky=W)
        
        self.e2 = Entry(frame, width=7)
        self.e2.bind()
        self.e2.grid(row=1, column=1)
        self.e2.delete(0, END)
        self.e2.insert(0, '0.05')
        
        self.label2 = Label(frame, text='Max. Lagrangian strain:')
        self.label2.grid(row=1, column=0, sticky=W)
        
        #Choose inputfile (Button)
        b2 = Button(frame, text="Inputfile", width=15, command=self.select_file)
        b2.grid(row=3, column=0, columnspan=2)
        
        b = Button(frame, text="set values", width=15, command=self.read_val)
        b.grid(row=4, column=0, columnspan=2)
        
        #Read structure (Button)
        b1 = Button(frame, text="Read structure", width=15, command=self.read_POS)
        b1.grid(row=5, column=0, columnspan=2)
        
        #Write structures (Button)
        b3 = Button(frame, text="Setup calculation", width=15, command=self.setup_calc)
        b3.grid(row=6, column=0, columnspan=2)
        
        #Strart calculations
        b4 = Button(frame, text="Calculation status", width=15, command=self.check_calc)
        b4.grid(row=7, column=0, columnspan=2)
        
        
        v = IntVar()
        r11 = Radiobutton(frame, text="Energy", variable=v, value=1)
        r12 = Radiobutton(frame, text="Strain", variable=v, value=2, state=DISABLED)
        r11.select()
        r11.grid(row=8, column=0, sticky=W)
        r12.grid(row=9, column=0, sticky=W)
        
        
        w = IntVar()
        r21 = Radiobutton(frame, text="2nd", variable=w, value=1)
        r22 = Radiobutton(frame, text="3rd", variable=w, value=2)
        r21.select()
        r21.grid(row=10, column=0, sticky=W)
        r22.grid(row=11, column=0, sticky=W)
        
        
        nb.add(frame, text='Setup', underline=0, padding=2)
        
        return
    
    
    def _create_analyze_tab(self, nb): 
        frame = Frame(nb, name='analyze')
        
#.........这里部分代码省略.........
开发者ID:tdengg,项目名称:pylastic,代码行数:103,代码来源:main.py


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