當前位置: 首頁>>代碼示例>>Python>>正文


Python simpledialog.askfloat方法代碼示例

本文整理匯總了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                            ###
############################################################################## 
開發者ID:Microvellum,項目名稱:Fluid-Designer,代碼行數:27,代碼來源:turtle.py

示例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.') 
開發者ID:NSGeophysics,項目名稱:GPRPy,代碼行數:21,代碼來源:gprpyGUI.py

示例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 
開發者ID:int-brain-lab,項目名稱:ibllib,代碼行數:16,代碼來源:graphic.py

示例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] 
開發者ID:NSGeophysics,項目名稱:GPRPy,代碼行數:9,代碼來源:gprpyGUI.py

示例5: setAspect

# 需要導入模塊: from tkinter import simpledialog [as 別名]
# 或者: from tkinter.simpledialog import askfloat [as 別名]
def setAspect(self):
        self.asp = sd.askfloat("Input","Plotting aspect ratio") 
開發者ID:NSGeophysics,項目名稱:GPRPy,代碼行數:4,代碼來源:gprpyGUI.py

示例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] 
開發者ID:NSGeophysics,項目名稱:GPRPy,代碼行數:8,代碼來源:gprpyGUI.py

示例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] 
開發者ID:NSGeophysics,項目名稱:GPRPy,代碼行數:12,代碼來源:gprpyGUI.py

示例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) 
開發者ID:NSGeophysics,項目名稱:GPRPy,代碼行數:6,代碼來源:gprpyGUI.py

示例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) 
開發者ID:NSGeophysics,項目名稱:GPRPy,代碼行數:7,代碼來源:gprpyGUI.py

示例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) 
開發者ID:NSGeophysics,項目名稱:GPRPy,代碼行數:8,代碼來源:gprpyGUI.py

示例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)] 
開發者ID:NSGeophysics,項目名稱:GPRPy,代碼行數:8,代碼來源:gprpyGUI.py

示例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) 
開發者ID:NSGeophysics,項目名稱:GPRPy,代碼行數:14,代碼來源:gprpyGUI.py

示例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 
開發者ID:NSGeophysics,項目名稱:GPRPy,代碼行數:12,代碼來源:gprpyCWGUI.py

示例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] 
開發者ID:NSGeophysics,項目名稱:GPRPy,代碼行數:9,代碼來源:gprpyCWGUI.py

示例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) 
開發者ID:NSGeophysics,項目名稱:GPRPy,代碼行數:6,代碼來源:gprpyCWGUI.py


注:本文中的tkinter.simpledialog.askfloat方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。