本文整理汇总了Python中tkinter.simpledialog.askfloat方法的典型用法代码示例。如果您正苦于以下问题:Python simpledialog.askfloat方法的具体用法?Python simpledialog.askfloat怎么用?Python simpledialog.askfloat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tkinter.simpledialog
的用法示例。
在下文中一共展示了simpledialog.askfloat方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: numinput
# 需要导入模块: from tkinter import simpledialog [as 别名]
# 或者: from tkinter.simpledialog import askfloat [as 别名]
def numinput(self, title, prompt, default=None, minval=None, maxval=None):
"""Pop up a dialog window for input of a number.
Arguments: title is the title of the dialog window,
prompt is a text mostly describing what numerical information to input.
default: default value
minval: minimum value for imput
maxval: maximum value for input
The number input must be in the range minval .. maxval if these are
given. If not, a hint is issued and the dialog remains open for
correction. Return the number input.
If the dialog is canceled, return None.
Example (for a TurtleScreen instance named screen):
>>> screen.numinput("Poker", "Your stakes:", 1000, minval=10, maxval=10000)
"""
return simpledialog.askfloat(title, prompt, initialvalue=default,
minvalue=minval, maxvalue=maxval)
##############################################################################
### End of Tkinter - interface ###
##############################################################################
示例2: exportVTK
# 需要导入模块: from tkinter import simpledialog [as 别名]
# 或者: from tkinter.simpledialog import askfloat [as 别名]
def exportVTK(self,proj):
outfile = fd.asksaveasfilename()
if outfile is not '':
#thickness = sd.askfloat("Input","Profile thickness [m]")
thickness = 0
if self.asp is None:
aspect = 1.0
else:
aspect = self.asp
if proj.threeD is None:
gpyes = mesbox.askyesno("Question","Do you have topography data for this profile?")
if gpyes:
filename = fd.askopenfilename()
self.getDelimiter()
proj.exportVTK(outfile,gpsinfo=filename,thickness=thickness,delimiter=self.delimiter,aspect=aspect)
else:
proj.exportVTK(outfile,gpsinfo=proj.threeD,thickness=thickness,delimiter=self.delimiter,aspect=aspect)
print('... done with exporting to VTK.')
示例3: numinput
# 需要导入模块: from tkinter import simpledialog [as 别名]
# 或者: from tkinter.simpledialog import askfloat [as 别名]
def numinput(title, prompt, default=None, minval=None, maxval=None,
nullable=False, askint=False):
root = tk.Tk()
root.withdraw()
ask = simpledialog.askinteger if askint else simpledialog.askfloat
ans = ask(
title, prompt, initialvalue=default, minvalue=minval, maxvalue=maxval)
if ans == 0:
return ans
elif not ans and not nullable:
return numinput(
title, prompt, default=default, minval=minval, maxval=maxval,
nullable=nullable, askint=askint)
return ans
示例4: setYrng
# 需要导入模块: from tkinter import simpledialog [as 别名]
# 或者: from tkinter.simpledialog import askfloat [as 别名]
def setYrng(self):
ylow = sd.askfloat("Input","Min Y value")
if ylow is not None:
yhigh = sd.askfloat("Input","Max Y value")
if yhigh is not None:
self.prevyrng=self.yrng
self.yrng=[ylow,yhigh]
示例5: setAspect
# 需要导入模块: from tkinter import simpledialog [as 别名]
# 或者: from tkinter.simpledialog import askfloat [as 别名]
def setAspect(self):
self.asp = sd.askfloat("Input","Plotting aspect ratio")
示例6: setXrng
# 需要导入模块: from tkinter import simpledialog [as 别名]
# 或者: from tkinter.simpledialog import askfloat [as 别名]
def setXrng(self):
xlow = sd.askfloat("Input","Min X value")
if xlow is not None:
xhigh = sd.askfloat("Input","Max X value")
if xhigh is not None:
self.xrng=[xlow,xhigh]
示例7: adjProfile
# 需要导入模块: from tkinter import simpledialog [as 别名]
# 或者: from tkinter.simpledialog import askfloat [as 别名]
def adjProfile(self,proj):
flipit = mesbox.askyesno("Question","Flip the profile (left to right)?")
if flipit:
proj.flipProfile()
minPos = sd.askfloat("Input","Start x coordinate")
if minPos is not None:
maxPos = sd.askfloat("Input","End x coordinate")
if maxPos is not None:
proj.adjProfile(minPos=minPos,maxPos=maxPos)
self.xrng=[minPos,maxPos]
示例8: setZeroTime
# 需要导入模块: from tkinter import simpledialog [as 别名]
# 或者: from tkinter.simpledialog import askfloat [as 别名]
def setZeroTime(self,proj):
newZeroTime = sd.askfloat("Input","New zero time")
if newZeroTime is not None:
proj.setZeroTime(newZeroTime=newZeroTime)
示例9: truncateY
# 需要导入模块: from tkinter import simpledialog [as 别名]
# 或者: from tkinter.simpledialog import askfloat [as 别名]
def truncateY(self,proj):
maxY = sd.askfloat("Input","Truncate at what y value\n"
"(two-way travel time or depth)")
if maxY is not None:
proj.truncateY(maxY)
示例10: cut
# 需要导入模块: from tkinter import simpledialog [as 别名]
# 或者: from tkinter.simpledialog import askfloat [as 别名]
def cut(self,proj):
minX = sd.askfloat("Input","Minimum profile position")
if minX is not None:
maxX = sd.askfloat("Input","Maximum profile position")
if maxX is not None:
proj.cut(minX,maxX)
示例11: setVelocity
# 需要导入模块: from tkinter import simpledialog [as 别名]
# 或者: from tkinter.simpledialog import askfloat [as 别名]
def setVelocity(self,proj):
velocity = sd.askfloat("Input","Radar wave velocity [m/ns]?")
if velocity is not None:
proj.setVelocity(velocity)
self.prevyrng=self.yrng
self.yrng=[0,np.max(proj.depth)]
示例12: showHyp
# 需要导入模块: from tkinter import simpledialog [as 别名]
# 或者: from tkinter.simpledialog import askfloat [as 别名]
def showHyp(self,proj,a):
x0 = sd.askfloat("Input","Hyperbola center on profile [m]")
if x0 is not None:
t0 = sd.askfloat("Input","Hyperbola apex location (two-way travel time [ns])")
if t0 is not None:
v = sd.askfloat("Input","Estimated velocity [m/ns]")
if v is not None:
y=proj.profilePos-x0
d=v*t0/2.0
k=np.sqrt(d**2 + np.power(y,2))
t2=2*k/v
a.plot(proj.profilePos,t2,'--c',linewidth=3)
示例13: setVelRng
# 需要导入模块: from tkinter import simpledialog [as 别名]
# 或者: from tkinter.simpledialog import askfloat [as 别名]
def setVelRng(self):
vmin = sd.askfloat("Input","Minimum velocity")
if vmin is not None:
self.vmin = vmin
vmax = sd.askfloat("Input","Maximum velocity")
if vmax is not None:
self.vmax = vmax
vint = sd.askfloat("Input","Velocity step size (interval)")
if vint is not None:
self.vint = vint
示例14: adjProfile
# 需要导入模块: from tkinter import simpledialog [as 别名]
# 或者: from tkinter.simpledialog import askfloat [as 别名]
def adjProfile(self,proj):
minPos = sd.askfloat("Input","Start x coordinate")
if minPos is not None:
maxPos = sd.askfloat("Input","End x coordinate")
if maxPos is not None:
proj.adjProfile(minPos=minPos,maxPos=maxPos)
self.xrng=[minPos,maxPos]
示例15: setZeroTime
# 需要导入模块: from tkinter import simpledialog [as 别名]
# 或者: from tkinter.simpledialog import askfloat [as 别名]
def setZeroTime(self,proj):
newZeroTime = sd.askfloat("Input","New zero time")
if newZeroTime is not None:
proj.setZeroTimeCW(newZeroTime=newZeroTime)