Python tkinter.simpledialog.askfloat() Examples

The following are 26 code examples of tkinter.simpledialog.askfloat(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module tkinter.simpledialog , or try the search function .
Example #1
Source File: turtle.py    From Fluid-Designer with GNU General Public License v3.0 7 votes vote down vote up
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                            ###
############################################################################## 
Example #2
Source File: turtle.py    From android_universal with MIT License 6 votes vote down vote up
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                            ###
############################################################################## 
Example #3
Source File: gprpyGUI.py    From GPRPy with MIT License 6 votes vote down vote up
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.') 
Example #4
Source File: turtle.py    From Carnets with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
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                            ###
############################################################################## 
Example #5
Source File: turtle.py    From odoo13-x64 with GNU General Public License v3.0 6 votes vote down vote up
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                            ###
############################################################################## 
Example #6
Source File: turtle.py    From ironpython3 with Apache License 2.0 6 votes vote down vote up
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                            ###
############################################################################## 
Example #7
Source File: turtle.py    From Imogen with MIT License 6 votes vote down vote up
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                            ###
############################################################################## 
Example #8
Source File: turtle.py    From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 6 votes vote down vote up
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                            ###
############################################################################## 
Example #9
Source File: gprpyGUI.py    From GPRPy with MIT License 5 votes vote down vote up
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) 
Example #10
Source File: graphic.py    From ibllib with MIT License 5 votes vote down vote up
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 
Example #11
Source File: gprpyCWGUI.py    From GPRPy with MIT License 5 votes vote down vote up
def addHyp(self,proj):
        self.showlnhp = True
        vel = sd.askfloat("Input","Velocity?")
        if vel is not None:            
            zerotwtt = sd.askfloat("Input","Zero two-way travel time?")
            if zerotwtt is not None:
                proj.addHyp(zerotwtt=zerotwtt,vel=vel) 
Example #12
Source File: gprpyCWGUI.py    From GPRPy with MIT License 5 votes vote down vote up
def addLin(self,proj):
        self.showlnhp = True
        vel = sd.askfloat("Input","Velocity?")
        if vel is not None:
            zerotwtt = sd.askfloat("Input","Zero two-way travel time?")
            if zerotwtt is not None:           
                proj.addLin(zerotwtt=zerotwtt,vel=vel) 
Example #13
Source File: gprpyCWGUI.py    From GPRPy with MIT License 5 votes vote down vote up
def tpowGain(self,proj):
        power = sd.askfloat("Input","Power for tpow gain?")
        if power is not None:
            proj.tpowGain(power=power) 
Example #14
Source File: gprpyCWGUI.py    From GPRPy with MIT License 5 votes vote down vote up
def truncateY(self,proj):
        maxY = sd.askfloat("Input","Maximum two-way travel time?")
        if maxY is not None:
            proj.truncateY(maxY) 
Example #15
Source File: gprpyCWGUI.py    From GPRPy with MIT License 5 votes vote down vote up
def setZeroTime(self,proj):
        newZeroTime = sd.askfloat("Input","New zero time")
        if newZeroTime is not None:
            proj.setZeroTimeCW(newZeroTime=newZeroTime) 
Example #16
Source File: gprpyCWGUI.py    From GPRPy with MIT License 5 votes vote down vote up
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] 
Example #17
Source File: gprpyCWGUI.py    From GPRPy with MIT License 5 votes vote down vote up
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 
Example #18
Source File: gprpyCWGUI.py    From GPRPy with MIT License 5 votes vote down vote up
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] 
Example #19
Source File: gprpyGUI.py    From GPRPy with MIT License 5 votes vote down vote up
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] 
Example #20
Source File: gprpyGUI.py    From GPRPy with MIT License 5 votes vote down vote up
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)] 
Example #21
Source File: gprpyGUI.py    From GPRPy with MIT License 5 votes vote down vote up
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) 
Example #22
Source File: gprpyGUI.py    From GPRPy with MIT License 5 votes vote down vote up
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) 
Example #23
Source File: gprpyGUI.py    From GPRPy with MIT License 5 votes vote down vote up
def setZeroTime(self,proj):
        newZeroTime = sd.askfloat("Input","New zero time")
        if newZeroTime is not None:
            proj.setZeroTime(newZeroTime=newZeroTime) 
Example #24
Source File: gprpyGUI.py    From GPRPy with MIT License 5 votes vote down vote up
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] 
Example #25
Source File: gprpyGUI.py    From GPRPy with MIT License 5 votes vote down vote up
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] 
Example #26
Source File: gprpyGUI.py    From GPRPy with MIT License 5 votes vote down vote up
def setAspect(self):
        self.asp = sd.askfloat("Input","Plotting aspect ratio")