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


Python Treeview.config方法代码示例

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


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

示例1: FilamentReport

# 需要导入模块: from ttk import Treeview [as 别名]
# 或者: from ttk.Treeview import config [as 别名]
class FilamentReport(Toplevel):
	def __init__(self, app, printer, settings, logger, *arg):
		self.app = app
		self.printer = printer
		self.settings = settings
		self.logger = logger
		
		layers = self.app.gcodeInfo.layerOrder
		usage = self.app.gcodeInfo.filLayers

		self.selection = None
		
		Toplevel.__init__(self, app, *arg)
		self.title("Layer by Layer Filament Usage")
		self.protocol("WM_DELETE_WINDOW", self.doCancel)

		f = Frame(self)
		f.grid(row=1, column=1, rowspan=1, padx=10)

		self.tree = Treeview(self, height=12, selectmode='browse')
		self.sb = Scrollbar(self)
		self.sb.config(command=self.tree.yview)
		self.tree.config(yscrollcommand=self.sb.set)

		ln = []
		for l in layerinfo:
			ln.append(l[0])
		del ln[0]
		self.tree.config(columns=ln)
		
		for l in layerinfo:
			self.tree.column(l[0], width=l[1], anchor=l[2])
			self.tree.heading(l[0], text=l[3])

		self.sb.pack(side=RIGHT, fill=Y)
		self.tree.pack(side=LEFT, fill=BOTH, expand=1)

		prev = 0.0	
		tl = layers[-1]
		total = usage[tl]		
		for l in layers:
			n = usage[l]
			self.tree.insert('', 'end', text=l, values=("%7.3f" % (n-prev), "%9.3f" % n, "%9.3f" % (total-n)))
			prev = n

	def doCancel(self):
		self.app.closeFilamentReport()
开发者ID:jbernardis,项目名称:repraphost,代码行数:49,代码来源:reports.py

示例2: MacroFrame

# 需要导入模块: from ttk import Treeview [as 别名]
# 或者: from ttk.Treeview import config [as 别名]
class MacroFrame(Frame):
    def __init__(self, parent):
        Frame.__init__(self, parent, background="white")
        self.parent = parent
        self.numStates = 0
        self.initUI()

    def initUI(self):
        self.columnconfigure(0, weight=0)
        self.columnconfigure(1, weight=0)
        self.columnconfigure(2, weight=1)
        self.columnconfigure(3, weight=1)

        self.rowconfigure(0, weight=1)

        self.commandFrame = Frame(self, background="white")
        self.commandFrame.grid(row=0, column=0, columnspan=5, sticky=W + E)
        self.commandFrame.columnconfigure(1, weight=1)

        self.btnCommand = Button(self.commandFrame, text="Run")
        self.btnCommand.grid(row=0, column=0)

        self.strCommand = StringVar()
        self.entCommand = Entry(self.commandFrame, textvariable=self.strCommand)
        self.entCommand.grid(row=0, column=1, sticky=W + E)

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

        self.treeview = Treeview(self, columns=("Angle"), displaycolumns="#all", selectmode="browse")
        self.treeview.grid(row=1, column=1, columnspan=4, sticky=N + S + W + E)
        self.treeScrollbar = Scrollbar(self)
        self.treeScrollbar.grid(row=1, column=5, sticky=N + S)
        self.treeview.config(yscrollcommand=self.treeScrollbar.set)
        self.treeScrollbar.config(command=self.treeview.yview)

        self.btnFrame = Frame(self, background="white")
        self.btnFrame.grid(row=2, column=0, columnspan=5, sticky=W + E)

        self.btnRun = Button(self.btnFrame, text="Run", command=self.runMacro)
        self.btnRun.grid(row=0, column=0)

        self.btnStop = Button(self.btnFrame, text="Stop")
        self.btnStop.grid(row=0, column=1)

        self.btnSaveMacro = Button(self.btnFrame, text="Save Macro", command=self.saveMacro)
        self.btnSaveMacro.grid(row=0, column=2)

        self.btnDeleteMacro = Button(self.btnFrame, text="Delete Macro")
        self.btnDeleteMacro.grid(row=0, column=3)

        self.btnDeleteState = Button(self.btnFrame, text="Delete State")
        self.btnDeleteState.grid(row=0, column=4)

    def addState(self, robot):
        stateName = "state" + str(self.numStates)
        self.treeview.insert("", END, iid=stateName, text=stateName)
        limbNum = 0
        for limb in robot.getLimbs():
            limbName = "limb" + str(limbNum)
            self.treeview.insert(stateName, END, iid=stateName + "_" + limbName, text=limbName)
            partNum = 0
            for part in limb.getComponents():
                partName = "joint" + str(partNum)
                if isinstance(part, Joint):
                    self.treeview.insert(
                        stateName + "_" + limbName,
                        END,
                        iid=stateName + "_" + limbName + "_" + partName,
                        text=partName,
                        values=[part.angle],
                    )
                    partNum += 1
            limbNum += 1
        self.numStates += 1

    def getState(self, stateNum, robot):
        stateName = "state" + str(stateNum)
        limbNum = 0
        for limb in robot.getLimbs():
            limbName = "limb" + str(limbNum)
            partNum = 0
            for part in limb.getComponents():
                partName = "joint" + str(partNum)
                if isinstance(part, Joint):
                    part.setAngle(int(self.treeview.item(stateName + "_" + limbName + "_" + partName, "values")[0]))
                    partNum += 1
            limbNum += 1

    def runMacro(self):
        thread = threading.Thread(target=self.updateState)
        thread.start()

    def updateState(self):
        for i in range(self.numStates):
            self.getState(i, self.parent.robotFrame.robot)
            time.sleep(0.1)

    def saveMacro(self):
        pass
开发者ID:demetraux,项目名称:Octopod,代码行数:102,代码来源:gui.py

示例3: __init__

# 需要导入模块: from ttk import Treeview [as 别名]
# 或者: from ttk.Treeview import config [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

示例4: ProjectVenster

# 需要导入模块: from ttk import Treeview [as 别名]
# 或者: from ttk.Treeview import config [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


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