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


Python Entry.config方法代码示例

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


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

示例1: MainWindow

# 需要导入模块: from ttk import Entry [as 别名]
# 或者: from ttk.Entry import config [as 别名]
class MainWindow(Tk):
    def __init__(self):
        Tk.__init__(self)
        self.title(mainWindowTitle)
        self.resizable(width=0, height=0)
        self.__setStyles()
        self.__initializeComponents()
        self.__dataController = DataController();
        self.mainloop()
            
    def __initializeComponents(self):
        self.imageCanvas = Canvas(master=self, width=imageCanvasWidth,
                                  height=windowElementsHeight, bg="white")
        self.imageCanvas.pack(side=LEFT, padx=(windowPadding, 0),
                              pady=windowPadding, fill=BOTH)
        
        self.buttonsFrame = Frame(master=self, width=buttonsFrameWidth,
                                  height=windowElementsHeight)
        self.buttonsFrame.propagate(0)
        self.loadFileButton = Button(master=self.buttonsFrame,
                                     text=loadFileButtonText, command=self.loadFileButtonClick)
        self.loadFileButton.pack(fill=X, pady=buttonsPadding);
        
        self.colorByLabel = Label(self.buttonsFrame, text=colorByLabelText)
        self.colorByLabel.pack(fill=X)
        self.colorByCombobox = Combobox(self.buttonsFrame, state=DISABLED,
                                        values=colorByComboboxValues)
        self.colorByCombobox.set(colorByComboboxValues[0])
        self.colorByCombobox.bind("<<ComboboxSelected>>", self.__colorByComboboxChange)
        self.colorByCombobox.pack(fill=X, pady=buttonsPadding)
        self.rejectedValuesPercentLabel = Label(self.buttonsFrame, text=rejectedMarginLabelText)
        self.rejectedValuesPercentLabel.pack(fill=X)
        self.rejectedValuesPercentEntry = Entry(self.buttonsFrame)
        self.rejectedValuesPercentEntry.insert(0, defaultRejectedValuesPercent)
        self.rejectedValuesPercentEntry.config(state=DISABLED)
        self.rejectedValuesPercentEntry.pack(fill=X, pady=buttonsPadding)        
        
        self.colorsSettingsPanel = Labelframe(self.buttonsFrame, text=visualisationSettingsPanelText)
        self.colorsTableLengthLabel = Label(self.colorsSettingsPanel, text=colorsTableLengthLabelText)
        self.colorsTableLengthLabel.pack(fill=X)
        self.colorsTableLengthEntry = Entry(self.colorsSettingsPanel)
        self.colorsTableLengthEntry.insert(0, defaultColorsTableLength)
        self.colorsTableLengthEntry.config(state=DISABLED)
        self.colorsTableLengthEntry.pack(fill=X)
        self.scaleTypeLabel = Label(self.colorsSettingsPanel, text=scaleTypeLabelText)
        self.scaleTypeLabel.pack(fill=X)
        self.scaleTypeCombobox = Combobox(self.colorsSettingsPanel, state=DISABLED,
                                          values=scaleTypesComboboxValues)
        self.scaleTypeCombobox.set(scaleTypesComboboxValues[0])
        self.scaleTypeCombobox.bind("<<ComboboxSelected>>", self.__scaleTypeComboboxChange)
        self.scaleTypeCombobox.pack(fill=X)
        self.colorsTableMinLabel = Label(self.colorsSettingsPanel, text=colorsTableMinLabelText)
        self.colorsTableMinLabel.pack(fill=X)
        self.colorsTableMinEntry = Entry(self.colorsSettingsPanel)
        self.colorsTableMinEntry.insert(0, defaultColorsTableMin)
        self.colorsTableMinEntry.config(state=DISABLED)
        self.colorsTableMinEntry.pack(fill=X)
        self.colorsTableMaxLabel = Label(self.colorsSettingsPanel, text=colorsTableMaxLabelText)
        self.colorsTableMaxLabel.pack(fill=X)
        self.colorsTableMaxEntry = Entry(self.colorsSettingsPanel)
        self.colorsTableMaxEntry.insert(0, defaultColorsTableMax)
        self.colorsTableMaxEntry.config(state=DISABLED)
        self.colorsTableMaxEntry.pack(fill=X)
        self.colorsSettingsPanel.pack(fill=X, pady=buttonsPadding)
        
        self.redrawButton = Button(master=self.buttonsFrame, text=redrawButtonText,
                                   state=DISABLED, command=self.__redrawButtonClick)
        self.redrawButton.pack(fill=X, pady=buttonsPadding)
        self.buttonsFrame.pack(side=RIGHT, padx=windowPadding, pady=windowPadding, fill=BOTH)
        
    def __setStyles(self):
        Style().configure("TButton", padding=buttonsTextPadding, font=buttonsFont)
    
    def loadFileButtonClick(self):
        fileName = tkFileDialog.askopenfilename(filetypes=[('Tablet files', '*.mtb'), ('Tablet files', '*.htd')])
        if (fileName):
            if (not self.__getInputParams()):
                self.__showInvalidInputMessage()
                return
            
            self.lastFileName = fileName;
            self.title(mainWindowTitle + " " + fileName)
            self.__draw(fileName)
            tkMessageBox.showinfo(measureDialogTitle, 
                                  measureDialogText + str(self.__dataController.getMeasure(fileName)))
            
            self.redrawButton.config(state=NORMAL)
            self.colorByCombobox.config(state="readonly")
            self.colorsTableLengthEntry.config(state=NORMAL)
            self.scaleTypeCombobox.config(state="readonly")
            
    def __redrawButtonClick(self):
        if (not self.__getInputParams()):
            self.__showInvalidInputMessage()
            return
        
        self.__draw(self.lastFileName)

    def __scaleTypeComboboxChange(self, event):
        if (self.scaleTypeCombobox.get() == relativeScaleType):
#.........这里部分代码省略.........
开发者ID:jsikorski,项目名称:HCC-tablet-data-presenter,代码行数:103,代码来源:interface.py

示例2: toolUI

# 需要导入模块: from ttk import Entry [as 别名]
# 或者: from ttk.Entry import config [as 别名]
class toolUI(Frame):
  
    def __init__(self, parent):
        Frame.__init__(self, parent)   
         
        self.parent = parent
        
        self.initUI()        
        
    def initUI(self):
      
        self.parent.title("Sequence modification parser")          
        
        self.columnconfigure(0, pad=5)
        self.columnconfigure(1, pad=5, weight = 1)
        self.columnconfigure(2, pad=5)
        
        self.rowconfigure(0, pad=5, weight = 1)
        self.rowconfigure(1, pad=5, weight = 1)
        self.rowconfigure(2, pad=5, weight = 1)
        self.rowconfigure(3, pad=5, weight = 1)
        self.rowconfigure(4, pad=5, weight = 1)
        self.rowconfigure(5, pad=5, weight = 1)
        
        self.lInput = Label(self, text = "Input file")
        self.lInput.grid(row = 0, column = 0, sticky = W)
        self.lPRS = Label(self, text = "phospoRS Column Name")
        self.lPRS.grid(row = 1, column = 0, sticky = W)
        self.lScore = Label(self, text = "Min phosphoRS Score")
        self.lScore.grid(row = 2, column = 0, sticky = W)
        self.lDA = Label(self, text = "Check deamidation sites")
        self.lDA.grid(row = 3, column = 0, sticky = W)
        self.lLabFile = Label(self, text = "Label description file")
        self.lLabFile.grid(row = 4, column = 0, sticky = W)
        
        self.ifPathText = StringVar()
        self.prsScoreText = StringVar(value = '0')
        self.prsNameText = StringVar()
        self.doDAVar = IntVar()
        self.labFileText = StringVar(value = path.abspath('moddict.txt'))
        
        self.ifPath = Entry(self, textvariable = self.ifPathText)
        self.ifPath.grid(row = 0, column = 1, sticky = W+E)
        self.prsName = Entry(self, textvariable = self.prsNameText)
        self.prsName.grid(row = 1, column = 1, sticky = W+E)        
        self.prsScore = Entry(self, textvariable = self.prsScoreText, state = DISABLED)
        self.prsScore.grid(row = 2, column = 1, sticky = W+E)
        self.doDABox = Checkbutton(self, variable = self.doDAVar)
        self.doDABox.grid(row = 3, column = 1, sticky = W)
        self.labFile = Entry(self, textvariable = self.labFileText)
        self.labFile.grid(row = 4, column = 1, sticky = W+E)
        
        
        self.foButton = Button(self, text = "Select file", command = self.selectFileOpen)
        self.foButton.grid(row = 0, column = 2, sticky = E+W, padx = 3)
        self.prsButton = Button(self, text = "Select column", state = DISABLED, command = self.selectColumn)
        self.prsButton.grid(row = 1, column = 2, sticky = E+W, padx = 3)
        self.labFileButton = Button(self, text = "Select file", command = self.selectLabFileOpen)
        self.labFileButton.grid(row = 4, column = 2, sticky = E+W, padx = 3)
        self.startButton = Button(self, text = "Start", command = self.start, padx = 3, pady = 3)
        self.startButton.grid(row = 5, column = 1, sticky = E+W)
        
    
        self.pack(fill = BOTH, expand = True, padx = 5, pady = 5)
        
    def selectFileOpen(self):
        #Open file dialog
        dlg = tkFileDialog.Open(self, filetypes = [('Excel spreadsheet', '*.xlsx')])
        openName = dlg.show()
        if openName != "":
            self.ifPathText.set(openName)
            self.findPRS(openName)#find phosphRS column
    
    def selectLabFileOpen(self):
        #Open labels file dialog
        dlg = tkFileDialog.Open(self, filetypes = [('All files', '*.*')])
        openName = dlg.show()
        if openName != "":
            self.labFileText.set(openName)
    
    def findPRS(self, openName):
        #find phosphoRS column
        worksheet = load_workbook(openName, use_iterators = True).get_active_sheet() #open excel sheet
        
        self.headers = [unicode(worksheet.cell(get_column_letter(columnNr) + '1').value).lower()
            for columnNr in range(1, worksheet.get_highest_column() + 1)]
        
        self.prsButton.config(state = "normal")
        
        if 'phosphors site probabilities' in self.headers:
            self.prsNameText.set('phosphoRS Site Probabilities')
        elif 'phosphors: phospho_sty site probabilities' in self.headers:
            self.prsNameText.set('PhosphoRS: Phospho_STY Site Probabilities')
        elif 'phosphors: phospho site probabilities' in self.headers:
            self.prsNameText.set('PhosphoRS: Phospho Site Probabilities')
        else:
            self.prsNameText.set('PhosphoRS column not found')
            return
            
        self.prsScore.config(state = 'normal')
#.........这里部分代码省略.........
开发者ID:caetera,项目名称:AddModSeq,代码行数:103,代码来源:addModSeq.py

示例3: initUI

# 需要导入模块: from ttk import Entry [as 别名]
# 或者: from ttk.Entry import config [as 别名]
    def initUI(self):
      
        self.parent.title("Resistor Calculator")
        
        Style().configure("TButton", padding=(0, 5, 0, 5), 
            font='serif 10')
        
        self.columnconfigure(0, pad=3)
        self.columnconfigure(1, pad=3)
        self.columnconfigure(2, pad=3)
        self.columnconfigure(3, pad=3)
        self.columnconfigure(4, pad=3)        
        self.columnconfigure(5, pad=3)

        self.rowconfigure(0, pad=3)
        self.rowconfigure(1, pad=3)
        self.rowconfigure(2, pad=3)
        self.rowconfigure(3, pad=3)
        self.rowconfigure(4, pad=3)
        self.rowconfigure(5, pad=3)
        self.rowconfigure(6, pad=3)
        self.rowconfigure(7, pad=3)
        self.rowconfigure(8, pad=3)
        self.rowconfigure(9, pad=3)
        self.rowconfigure(10, pad=3)
        self.rowconfigure(11, pad=3)
        self.rowconfigure(12, pad=3)


        entry = Entry(self)
        entry.grid(row=0, columnspan=4, sticky=W+E)
        global resistance
        resistance=""
        def ringOne(number):
            entry.delete(0, END)
            entry.insert(0, str(number))
            global resistance
            resistance = resistance + str(number)
        def ringTwo(number):
            ent=str(number)
            entry.insert(END, str(number))
            global resistance
            resistance = resistance + str(number)
        def ringThree(number): 
            ent=str(number)
            entry.insert(END, str(number))
            global resistance
            resistance = resistance + str(number)
        def ringFour(number):
            global resistance
            entry.delete(0, END)
            for x in range (0, number):
               resistance = resistance + "0"
            ent = "Resistance is: " + resistance
            entry.insert(END,ent)
            resistance = ""
        def cls():
            global resistance
            resistance = ""
            entry.delete(0, END)
            entry.insert(0,"Please Select ring colors")
               
        entry.insert(0,"Please Select ring colors")
        entry.config(justify=RIGHT)

        black = Button(self, text="Black", command=lambda: ringOne(0))
        black.grid(row=2, column=0)
        brown = Button(self, text="Brown", command=lambda: ringOne(1))
        brown.grid(row=3, column=0)
        red = Button(self, text = "Red", command=lambda: ringOne(2))
        red.grid(row=4, column=0)    
        orange = Button(self, text="Orange", command=lambda: ringOne(3))
        orange.grid(row=5, column=0)        
        yellow = Button(self, text="Yellow", command=lambda: ringOne(4))
        yellow.grid(row=6, column=0)        
        green = Button(self, text="Green", command=lambda: ringOne(5))
        green.grid(row=7, column=0)         
        blue = Button(self, text="Blue", command=lambda: ringOne(6))
        blue.grid(row=8, column=0) 
        violet = Button(self, text="Violet", command=lambda: ringOne(7))
        violet.grid(row=9, column=0) 
        grey = Button(self, text = "Grey", command=lambda: ringOne(8))
        grey.grid(row=10, column = 0)
        white = Button(self, text="White", command=lambda: ringOne(9))
        white.grid(row=11,column = 0)

        black2 = Button(self, text="Black", command=lambda: ringTwo(0))
        black2.grid(row=2, column=1)
        brown2 = Button(self, text="Brown", command=lambda: ringTwo(1))
        brown2.grid(row=3, column=1)
        red2 = Button(self, text = "Red", command=lambda: ringTwo(2))
        red2.grid(row=4, column=1)    
        orange2 = Button(self, text="Orange", command=lambda: ringTwo(3))
        orange2.grid(row=5, column=1)        
        yellow2 = Button(self, text="Yellow", command=lambda: ringTwo(4))
        yellow2.grid(row=6, column=1)        
        green2 = Button(self, text="Green", command=lambda: ringTwo(5))
        green2.grid(row=7, column=1)         
        blue2 = Button(self, text="Blue", command=lambda: ringTwo(6))
        blue2.grid(row=8, column=1) 
#.........这里部分代码省略.........
开发者ID:dvalenza,项目名称:Resistance-Calculator,代码行数:103,代码来源:resistanceCalc.py

示例4: Principal

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

#.........这里部分代码省略.........
			self.theta_disc.remove(0)
			self.r_disc.remove(0)
			self.theta_disc_n.remove(0)
			ax.plot([self.theta_disc[0],self.theta_disc_n[0]], [self.r_disc[0], self.r_disc[0]], color='r')
			ax.plot([0],[0], color='m', marker='o', markersize=5)

		self.StringLongitud.set("%#.1f cm" % l)
		self.StringRadio.set("%#.1f cm" % max(self.r_disc))

		ax.plot(self.theta_disc, self.r_disc, color='b', marker='.', markersize=4)
		if self.espejar.get():
			ax.plot(self.theta_disc_n, self.r_disc, color='g', marker='.', markersize=4)

		ax.set_rmax(max(self.r_disc))
		ax.grid(True)

		#with open('distancias.csv', 'wb') as f:
		#	writer = csv.writer(f)
		#	writer.writerows(izip(self.theta_disc, l_vec))


	def regraficar(self):
		self.grafico()
		self.canvas.get_tk_widget().pack_forget()
		self.canvas = FigureCanvasTkAgg(self.f, master=self.frame2)
		#canvas.show()
		self.canvas.get_tk_widget().pack(side=TOP,fill=BOTH, expand=1, padx=10, pady=10)

	def cambiaFormula(self):
		curvas = ['''R0lGODlhbAAWAOMPAAwMDLa2thYWFiIiIlBQUJ6enubm5gQEBGJiYszMzEBAQDAwMHR0dIqKigAAAP///yH5BAEKAA8ALAAAAABsABYAAAT+8MlJq7046817ToYnjmRpXsqpriw3JGgrz2pDHHDFFHTvezjL4kcsWoKUBIHCQDQQxmhy4EhZDATGkoKcEHIPwjIBkJoljsZVEFIwuGDJUJJwhM7ngN0i4D0YcxJdDwVqEg0CeC0DHQhlOokSCJGCcVYSAYyHiiaaGwOXEwCGDwqRBQgOC28PBqEPCAgMDDANgH8MCnEzAQSxCFufHQ6xuSF6FACeFgwBG1AHCwYGaSgC19jZAssViHQOrMIbelsIQwoHCuoLDsFCGwUgDn67LXVgDvUX3BeOEw0OHgCAcmgeBgME4QUssoBSgQMe+Am5lOqBQQkKHq0gIHEGMS9yHU1lO6CN34FwDamBOZBQhYCWGERqyyaxjp8HLyNuoOYMDYI6//awcNDzh0oJ1HiEy9CRwsIHDSBanCBg6YkCT4kA8EPAToGiTDkIgGEAQM8XsAKtuGUkgRsoYqxiaDrBbS4wbmNx2iuBLt+/HNQCfhABADs=''',
		'''R0lGODlhQwASAOMPAAwMDLa2thYWFiIiIlBQUJ6enubm5gQEBGJiYszMzEBAQDAwMHR0dIqKigAAAP///yH5BAEKAA8ALAAAAABDABIAAATn8MlJq70463ZSJQyhjWSpGUe1BM/imXCcNQvVDNLQyHz/KAOGgiXYPQAsn7IEKDwKg4SDgCA4DMtsBiVpCAqALk5LrhRqPwIt5yy7H4GaAWBIKJ7391uBULyoIhMNDDUMQi9uAVQIVRQJCAyMMAgPBwsGBg5GFAoCnp+gAmMXXhJSDBOEE3kkBQmZbYhkUogOLwEHWHCBJgUOehMLAhMFKTlBkG0wBKN6DpQSzBMOqD4C0BmdoaHNE1LK1xKwSg5Jepkv46gOyk+yGr7AE03RVwUsCrwF1SWq8g92Ij0gAGIClUjmSEQAADs=''',
		'''''']
		formula = PhotoImage(data=curvas[self.tipoCurva.get()-1])
		self.formulaLabel.configure(image=formula)
		self.formulaLabel.image = formula

		if self.tipoCurva.get() == 1:
			self.parC.config(state=NORMAL)
			self.labelC.config(state=NORMAL)
		else:
			self.parC.config(state=DISABLED)
			self.labelC.config(state=DISABLED)

	def activarFuente(self):
		if self.espejar.get():
			self.checkFuente.config(state=NORMAL)
		else:
			self.checkFuente.config(state=DISABLED)

	def escribirFichero(self):
		tipoCurva = ['Arq', 'Log']
		c = [self.c.get() + ' ', '']

		self.file_opt = options = {}
		options['defaultextension'] = '.nec'
		options['filetypes'] = [('NEC2 files', '.nec'),('all files', '.*')]
		options['initialdir'] = '~/Documentos/Antenas/Espirales'
		options['initialfile'] = 'Spiral ' + tipoCurva[int(self.tipoCurva.get())-1] + ' ' + \
									self.a.get() + ' ' + self.b.get() + ' ' + c[int(self.tipoCurva.get())-1] + self.lMax.get() + ' ' + self.frec.get() + '.nec'
		options['parent'] = self.parent
		options['title'] = 'Save NEC'

		fich = tkFileDialog.asksaveasfile(mode='w', **self.file_opt)

		r_final = list(reversed(self.r_disc)) + self.r_disc
		theta_final = list(reversed(self.theta_disc_n)) + self.theta_disc
开发者ID:AlbMA,项目名称:PySAD,代码行数:70,代码来源:pySAD.py


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