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


Python tkSimpleDialog.askfloat函数代码示例

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


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

示例1: getfiles

	def getfiles():
		files = tkFileDialog.askopenfilenames(parent=root,title='Choose image stack files')
		if not files: return
		filenames = []
		for fname in files:
			filenames.append(os.path.split(fname)[1])
		if len(files) > 10:
			filenames = filenames[0:10]
			filenames.append("...")
		ss_in = tkSimpleDialog.askfloat(
			parent=root, title='Enter ORIGINAL focus step size',
			prompt='Enter ORIGINAL focus step size for:\n'+'\n'.join('{}'.format(k) for k in filenames))
		if not ss_in: return
		pixelsize = pxSize(files[0])
		if pixelsize is None: pixelsize = 0
		ss_out = tkSimpleDialog.askfloat(
			parent=root, title='Enter INTERPOLATED focus step size',
			prompt='Enter INTERPOLATED focus step size for:\n'+'\n'.join('{}'.format(k) for k in filenames), initialvalue=pixelsize*1000)
		if not ss_out: return
		print "Selected files: {0}\n".format(files), "\n", "Focus step size in: {0} | out: {1}\n".format(ss_in,ss_out),\
			"Interpolation method: {0}\n".format(int_method.get())
		for filename in files:
			main(filename,ss_in, ss_out, saveorigstack=False, interpolationmethod=int_method.get(), showgraph=bool(showgraph.get()))
		print "Finished interpolation."
		print "="*40
开发者ID:Splo0sh,项目名称:3DCT,代码行数:25,代码来源:stackProcessing.py

示例2: ask_float

def ask_float(prompt, default=None, min=0.0,max=100.0, title=''):
	""" Get input from the user, validated to be an float (decimal number). default refers to the value which is initially in the field. By default, from 0.0 to 100.0; change this by setting max and min. Returns None on cancel."""
	import tkSimpleDialog
	if default:
		return tkSimpleDialog.askfloat(title, prompt, minvalue=min, maxvalue=max, initialvalue=default)
	else:
		return tkSimpleDialog.askfloat(title, prompt, minvalue=min, maxvalue=max)
开发者ID:kleopatra999,项目名称:downpoured_midi_audio,代码行数:7,代码来源:midirender_util.py

示例3: gui_addfigure

    def gui_addfigure(self,ll_lat=None,ll_lon=None,ur_lat=None,ur_lon=None):
        'GUI handler for adding figures forecast maps to basemap plot'
        import tkSimpleDialog
        try:
            from scipy.misc import imread
            import PIL
            filename = self.gui_file_select(ext='.png',ftype=[('All files','*.*'),
                                                          ('PNG','*.png'),
							  ('JPEG','*.jpg'),
							  ('GIF','*.gif')])
            if not filename:
                print 'Cancelled, no file selected'
                return
            print 'Opening png File: %s' %filename
            img = imread(filename)
        except:
            import tkMessageBox
            tkMessageBox.showwarning('Sorry','Error occurred unable to load file')
            return
	# get the corners
	if not ll_lat:
	    ll_lat = tkSimpleDialog.askfloat('Lower left lat','Lower left lat? [deg]')
	    ll_lon = tkSimpleDialog.askfloat('Lower left lon','Lower left lon? [deg]')
	    ur_lat = tkSimpleDialog.askfloat('Upper right lat','Upper right lat? [deg]')
	    ur_lon = tkSimpleDialog.askfloat('Upper right lon','Upper right lon? [deg]')
	self.line.addfigure_under(img,ll_lat,ll_lon,ur_lat,ur_lon)
开发者ID:samuelleblanc,项目名称:flight_planning,代码行数:26,代码来源:gui.py

示例4: addIso

 def addIso(self):
   isovalue=tkSimpleDialog.askfloat("Isosurface Level","What function value should the isosurface be at?")
   isocolor = tkColorChooser.askcolor(title="Isosurface Color")
   isoopacity = tkSimpleDialog.askfloat("Isosurface Opacity","What opacity should the isosurface have? 0 = transparent.")
   surf = isosurface(self.reader.GetOutputPort(),isovalue,isocolor[0][0],isocolor[0][1],isocolor[0][2],isoopacity) 
   self.isosurfaces.append(surf)
   self.isolist.insert(Tkinter.END,str(surf))
   self.ren.AddActor(surf.actor)
开发者ID:iamthad,项目名称:SSC374E,代码行数:8,代码来源:__Assignment1_bak1.py

示例5: editIso

 def editIso(self,i):
   isovalue=tkSimpleDialog.askfloat("Isosurface Level","What function value should the isosurface be at?",initialvalue=self.isosurfaces[i].value)
   isocolor = tkColorChooser.askcolor(initialcolor=(self.isosurfaces[i].R,self.isosurfaces[i].G,self.isosurfaces[i].B),title="Isosurface Color")
   isoopacity = tkSimpleDialog.askfloat("Isosurface Opacity","What opacity should the isosurface have? 0 = transparent.",initialvalue=self.isosurfaces[i].opacity)
   surf = isosurface(self.reader.GetOutputPort(),isovalue,isocolor[0][0],isocolor[0][1],isocolor[0][2],isoopacity)
   self.delIso(i)
   self.isosurfaces.append(surf)
   self.isolist.insert(Tkinter.END,str(surf))
   self.ren.AddActor(surf.actor)
开发者ID:iamthad,项目名称:SSC374E,代码行数:9,代码来源:__Assignment1_bak1.py

示例6: get_weight

 def get_weight(self):
     """Get weight from scale or if not connected from dialog"""
     if self.scale is None: 
         weight = tkSimpleDialog.askfloat("Weight Entry", "Weight (lbs):")
     else:
         try:
             weight = self.scale.get_weight()
         except ScaleError.ScaleError:
             print "Error reading scale, enter weight manually"
             weight = tkSimpleDialog.askfloat("Weight Entry", "Weight (lbs):")
     return weight
开发者ID:ddavedd,项目名称:Register,代码行数:11,代码来源:register.py

示例7: getCountRateHist

    def getCountRateHist(self):
        '''Plots a histogram of the count rate.  The number of bins is 
        for the histogram, and the sample length is how long the count rate
        is averaged over (equivalent to "sample length" for the count rate
        vs. time graph.'''

        #check if data has been imported. if not, give a warning
        if self.dataSet:

            #ask for number of bins for histogram
            labelText = "Enter the number of bins"
            numBins = tksd.askinteger("Count Rate Histogram", labelText, parent=self.root, minvalue=1)
            if not numBins:
                return

            #ask for length of sample to calculate count rate
            labelText = "Enter the sample length (seconds)"
            sampleLength = tksd.askfloat("Sample Length", labelText, parent=self.root, minvalue=0)
            if not sampleLength:
                return

            #plot histogram in matplotlib
            pd.plotHistOfCountRates(self.dataSet, sampleLength, numBins)

        else:
            self.showImportAlert()
开发者ID:samkohn,项目名称:Geiger-Counter,代码行数:26,代码来源:GUI.py

示例8: go

def go():

    
    root = Tk()
    name_list = DisplaySpectrum(root)
    
    if name_list !='':
        normalize = True
        if normalize == True:
            kNorm = tkSimpleDialog.askfloat('normalization constant', 'norms')
            if kNorm == '':
                kNorm = 1
        else:
            kNorm = 1
               
        view_only = False
        if view_only:
            ConsolidateFiles(name_list, smooth = False)
            i = 5
            plot(arange(2800,3605,5),x[1], 'ks')
        
            plot(arange(2800,3605,5),SG_Smooth(x[1], width = 11,plot = False))
        else:
            
            ConsolidateFiles(name_list, smooth = True)
            SaveSpectrum(root, name_list, x)
    root.destroy()
    
    
    
    root.mainloop()   
    return None
开发者ID:cmthompson,项目名称:SFGMe,代码行数:32,代码来源:SFG_Analysis.py

示例9: align_images

def align_images(im1, im2):

	# Convert images to grayscale
	im1_gray = cv2.cvtColor(im1,cv2.COLOR_BGR2GRAY)
	im2_gray = cv2.cvtColor(im2,cv2.COLOR_BGR2GRAY)
 
	# Find size of image1
	sz = im1.shape

	# Define the motion model
	warp_mode = cv2.MOTION_HOMOGRAPHY
	
	#Define the warp matrix
	warp_matrix = np.eye(3, 3, dtype=np.float32)

	#Define the number of iterations
	number_of_iterations = askinteger("Iterations", "Enter a number between 5 andd 5000",initialvalue=500,minvalue=5,maxvalue=5000)

	#Define correllation coefficient threshold
	#Specify the threshold of the increment in the correlation coefficient between two iterations
	termination_eps = askfloat("Threshold", "Enter a number between 1e-10 and 1e-50",initialvalue=1e-10,minvalue=1e-50,maxvalue=1e-10)

	#Define termination criteria
	criteria = (cv2.TERM_CRITERIA_EPS | cv2.TERM_CRITERIA_COUNT, number_of_iterations,  termination_eps)
 
	#Run the ECC algorithm. The results are stored in warp_matrix.
	(cc, warp_matrix) = cv2.findTransformECC (im1_gray,im2_gray,warp_matrix, warp_mode, criteria)

	#Use warpPerspective for Homography 
	im_aligned = cv2.warpPerspective (im2, warp_matrix, (sz[1],sz[0]), flags=cv2.INTER_LINEAR + cv2.WARP_INVERSE_MAP)
	
	save1 = asksaveasfilename(defaultextension=".jpg", title="Save aligned image")
	cv2.imwrite(save1,im_aligned)
开发者ID:TheJark,项目名称:Image-Matching,代码行数:33,代码来源:image_align2.py

示例10: demagnetize

def demagnetize():
	max_field = float(F1.get())
	steps = int(F2.get())
	kepcoInit()

	while (field2curr(max_field) >= 3.0):
		max_field = tkSimpleDialog.askfloat('MAGNET OVERLOAD','Choose a new value for the field or decrease the gap!')
	step_field = max_field/(steps+1)
	list_fields = r_[max_field:step_field/2-step_field/10:-step_field]

	for my_field in list_fields:
		my_write_curr = field2curr(my_field)
		kepco.write("CURR %f"%(my_write_curr))
		#print "FIELD++ = ",my_val
		time.sleep(0.2)
		my_read_curr = float(kepco.ask("MEAS:CURR?"))
		my_read_field = curr2field(my_read_curr)
		print "MEASURED FIELD:  ",my_read_field
		my_back_field = my_field-step_field/2
		my_back_write_curr = field2curr(my_back_field)
		kepco.write("CURR %f"%(-my_back_write_curr))
		#print "FIELD-- = ",-my_val_back
		time.sleep(0.2)
		my_read_curr = float(kepco.ask("MEAS:CURR?"))
		my_read_field = curr2field(my_read_curr)
		print "MEASURED FIELD:  ",my_read_field
	kepco.write("CURR 0.0")
	kepco.write("OUTP OFF")
	print "sample demagnetized!"
	del my_write_curr
	del my_read_curr
	del my_read_field
	del my_field
开发者ID:stefanstanescu,项目名称:MOKE_control,代码行数:33,代码来源:MOKE_X_GUI.py

示例11: popup

def popup(which, message, title=None):
    """Displays A Pop-Up Message."""
    if title is None:
        title = which
    which = superformat(which)
    if which == "info":
        return tkMessageBox.showinfo(str(title), str(message))
    elif which == "warning":
        return tkMessageBox.showwarning(str(title), str(message))
    elif which == "error":
        return tkMessageBox.showerror(str(title), str(message))
    elif which == "question":
        return tkMessageBox.askquestion(str(title), str(message))
    elif which == "proceed":
        return tkMessageBox.askokcancel(str(title), str(message))
    elif which == "yesorno":
        return tkMessageBox.askyesno(str(title), str(message))
    elif which == "retry":
        return tkMessageBox.askretrycancel(str(title), str(message))
    elif which == "entry":
        return tkSimpleDialog.askstring(str(title), str(message))
    elif which == "integer":
        return tkSimpleDialog.askinteger(str(title), str(message))
    elif which == "float":
        return tkSimpleDialog.askfloat(str(title), str(message))
开发者ID:evhub,项目名称:rabbit,代码行数:25,代码来源:gui.py

示例12: setOffset

 def setOffset(self):
     newOffset = askfloat(parent = self.interior(),
                          title = self['text'],
                          prompt = 'Start offset (seconds):')
     if newOffset != None:
         self.offset = newOffset
         self.updateDisplay()
开发者ID:Toonerz,项目名称:TTRInjector,代码行数:7,代码来源:AnimPanel.py

示例13: update_integration_time

def update_integration_time():
    cur_itime = server.get_integration_time()
    itime = askfloat('Set integration time', 'Seconds: ', parent=root, initialvalue=cur_itime)
    if itime:
        server.stop_correlator()
        server.set_integration_time(itime)
        server.start_correlator()
开发者ID:sma-wideband,项目名称:phringes_sw,代码行数:7,代码来源:plot_vlbi.py

示例14: askstr

	def askstr(self, f):
		theta=tkSimpleDialog.askfloat("test askinteger", "deg",)
		if f=="sin":
			data=str(math.sin(math.radians(theta)))
		if f=="cos":
			data=str(math.cos(math.radians(theta)))
		self.set(data)
开发者ID:anondroid5,项目名称:Tkinter,代码行数:7,代码来源:askfloat.py

示例15: change_cart_amount

 def change_cart_amount(self, cart_row):
     """Change the amount of a product entry in a cart"""
     print 'Changing amount of item in cart'
     self.simple_lock()
     if self.cart[cart_row].product.is_by_weight:
         amount = tkSimpleDialog.askfloat("Enter new weight", "Weight:")
     elif self.cart[cart_row].product.is_premarked:
         amount = tkSimpleDialog.askfloat("Enter new amount", "Amount:")
     else:
         amount = tkSimpleDialog.askinteger("Enter new amount", "Amount:")
     self.simple_unlock()
         
     if amount is None:
         print "Canceled"
     elif amount == 0:
         print "Can't update amount to 0, use delete key instead"
     else:
         print "Updated amount " + str(amount)
         self.cart[cart_row].change_amount(amount)
     self.update_cart()
开发者ID:ddavedd,项目名称:Register,代码行数:20,代码来源:register.py


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