Python tkinter.simpledialog.askinteger() Examples

The following are 22 code examples of tkinter.simpledialog.askinteger(). 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: gprpyGUI.py    From GPRPy with MIT License 6 votes vote down vote up
def remMeanTrace(self,proj):
        ntraces = sd.askinteger("Input","Remove mean over how many traces?")
        if ntraces is not None:
            proj.remMeanTrace(ntraces=ntraces) 
Example #2
Source File: EditorWindow.py    From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 5 votes vote down vote up
def change_indentwidth_event(self, event):
        new = self.askinteger(
                  "Indent width",
                  "New indent width (2-16)\n(Always use 8 when using tabs)",
                  parent=self.text,
                  initialvalue=self.indentwidth,
                  minvalue=2,
                  maxvalue=16)
        if new and new != self.indentwidth and not self.usetabs:
            self.indentwidth = new
        return "break" 
Example #3
Source File: gprpyCWGUI.py    From GPRPy with MIT License 5 votes vote down vote up
def printFigures(self,proj,fig):
        dpi=None
        # Make combined figure
        figname = fd.asksaveasfilename(defaultextension=".pdf",
                                       title="Filename for figures")
        if figname is not '':
            fignamesplit=os.path.splitext(figname)
            dpi = sd.askinteger("Input","Resolution in dots per inch? (Recommended: 600)")
            if dpi is not None:
                fig.savefig(figname, format='pdf', dpi=dpi)
                print('Printed %s' %(figname))
                # Also create individual figures
                proj.printCWFigure(fignamesplit[0]+"_data"+fignamesplit[1], color=self.color.get(),
                                   contrast=self.contrast.get(),
                                   yrng=self.yrng, xrng=self.xrng,
                                   dpi=dpi, showlnhp=self.showlnhp)                
                print('Printed %s' %(fignamesplit[0]+"_data"+fignamesplit[1]))
                
                if proj.linStAmp is not None:
                     proj.printStAmpFigure(fignamesplit[0]+"_linStAmp"+fignamesplit[1], whichstamp="lin",
                                           saturation=self.saturation.get(),
                                           yrng=self.yrng, vrng=[self.vmin,self.vmax],
                                           dpi=dpi)
                     print('Printed %s' %(fignamesplit[0]+"_linStAmp"+fignamesplit[1]))
                     
                if proj.hypStAmp is not None:
                     proj.printStAmpFigure(fignamesplit[0]+"_hypStAmp"+fignamesplit[1], whichstamp="hyp",
                                           saturation=self.saturation.get(),
                                           yrng=self.yrng, vrng=[self.vmin,self.vmax],
                                           dpi=dpi)
                     print('Printed %s' %(fignamesplit[0]+"_hypStAmp"+fignamesplit[1])) 
Example #4
Source File: gprpyCWGUI.py    From GPRPy with MIT License 5 votes vote down vote up
def agcGain(self,proj):
        window = sd.askinteger("Input","Window length for AGC?")
        if window is not None:
            proj.agcGain(window=window) 
Example #5
Source File: gprpyCWGUI.py    From GPRPy with MIT License 5 votes vote down vote up
def smooth(self,proj):
        window = sd.askinteger("Input",
                               "Smoothing window width (number of samples)")
        if window is not None:
            proj.smooth(window=window) 
Example #6
Source File: gprpyCWGUI.py    From GPRPy with MIT License 5 votes vote down vote up
def dewow(self,proj):
        window = sd.askinteger("Input","Dewow window width (number of samples)")
        if window is not None:
            proj.dewow(window=window) 
Example #7
Source File: gprpyGUI.py    From GPRPy with MIT License 5 votes vote down vote up
def profileSmooth(self,proj):
        ntraces = sd.askinteger("Input","Smooth over how many traces (m)")
        if ntraces is not None:
            noversample = sd.askinteger("Input","Make how many copies of each trace (n).\nRecommended: Same as number of traces to be smoothed.")
            if noversample is not None:
                proj.profileSmooth(ntraces,noversample) 
Example #8
Source File: gprpyGUI.py    From GPRPy with MIT License 5 votes vote down vote up
def agcGain(self,proj):
        window = sd.askinteger("Input","Window length for AGC?")
        if window is not None:
            proj.agcGain(window=window) 
Example #9
Source File: gprpyGUI.py    From GPRPy with MIT License 5 votes vote down vote up
def smooth(self,proj):
        window = sd.askinteger("Input","Smoothing window width (number of samples)")
        if window is not None:
            proj.smooth(window=window) 
Example #10
Source File: gprpyGUI.py    From GPRPy with MIT License 5 votes vote down vote up
def dewow(self,proj):
        window = sd.askinteger("Input","Dewow window width (number of samples)")
        if window is not None:
            proj.dewow(window=window) 
Example #11
Source File: EditorWindow.py    From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 5 votes vote down vote up
def _asktabwidth(self):
        return self.askinteger(
            "Tab width",
            "Columns per tab? (2-16)",
            parent=self.text,
            initialvalue=self.indentwidth,
            minvalue=2,
            maxvalue=16)

    # Guess indentwidth from text content.
    # Return guessed indentwidth.  This should not be believed unless
    # it's in a reasonable range (e.g., it will be 0 if no indented
    # blocks are found). 
Example #12
Source File: pynpuzzle.py    From pynpuzzle with MIT License 5 votes vote down vote up
def n_step_random_command():
    """
    Generates a random puzzle that can be solved in n-step.
    """
    n_step = simpledialog.askinteger("n-step random", "Enter number of steps:", parent=main_window)

    if not n_step:
        return

    puzzle = list_to_puzzle(GOAL_STATE)
    prev_puzzle = puzzle
    for i in range(n_step):
        new_puzzles = operator(puzzle)

        for i in range(len(new_puzzles)):
            if puzzles_equal(new_puzzles[i], prev_puzzle):
                del new_puzzles[i]
                break

        prev_puzzle = puzzle
        puzzle = new_puzzles[random.randrange(0, len(new_puzzles))]

    fill_puzzle_frame(input_puzzle_frame, puzzle_to_list(puzzle))


# Input's n-step random button widget 
Example #13
Source File: EditorWindow.py    From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 5 votes vote down vote up
def goto_line_event(self, event):
        text = self.text
        lineno = tkSimpleDialog.askinteger("Goto",
                "Go to line number:",parent=text)
        if lineno is None:
            return "break"
        if lineno <= 0:
            text.bell()
            return "break"
        text.mark_set("insert", "%d.0" % lineno)
        text.see("insert") 
Example #14
Source File: EditorWindow.py    From ironpython3 with Apache License 2.0 5 votes vote down vote up
def _asktabwidth(self):
        return self.askinteger(
            "Tab width",
            "Columns per tab? (2-16)",
            parent=self.text,
            initialvalue=self.indentwidth,
            minvalue=2,
            maxvalue=16)

    # Guess indentwidth from text content.
    # Return guessed indentwidth.  This should not be believed unless
    # it's in a reasonable range (e.g., it will be 0 if no indented
    # blocks are found). 
Example #15
Source File: EditorWindow.py    From ironpython3 with Apache License 2.0 5 votes vote down vote up
def change_indentwidth_event(self, event):
        new = self.askinteger(
                  "Indent width",
                  "New indent width (2-16)\n(Always use 8 when using tabs)",
                  parent=self.text,
                  initialvalue=self.indentwidth,
                  minvalue=2,
                  maxvalue=16)
        if new and new != self.indentwidth and not self.usetabs:
            self.indentwidth = new
        return "break" 
Example #16
Source File: EditorWindow.py    From ironpython3 with Apache License 2.0 5 votes vote down vote up
def goto_line_event(self, event):
        text = self.text
        lineno = tkSimpleDialog.askinteger("Goto",
                "Go to line number:",parent=text)
        if lineno is None:
            return "break"
        if lineno <= 0:
            text.bell()
            return "break"
        text.mark_set("insert", "%d.0" % lineno)
        text.see("insert") 
Example #17
Source File: EditorWindow.py    From Fluid-Designer with GNU General Public License v3.0 5 votes vote down vote up
def _asktabwidth(self):
        return self.askinteger(
            "Tab width",
            "Columns per tab? (2-16)",
            parent=self.text,
            initialvalue=self.indentwidth,
            minvalue=2,
            maxvalue=16)

    # Guess indentwidth from text content.
    # Return guessed indentwidth.  This should not be believed unless
    # it's in a reasonable range (e.g., it will be 0 if no indented
    # blocks are found). 
Example #18
Source File: EditorWindow.py    From Fluid-Designer with GNU General Public License v3.0 5 votes vote down vote up
def change_indentwidth_event(self, event):
        new = self.askinteger(
                  "Indent width",
                  "New indent width (2-16)\n(Always use 8 when using tabs)",
                  parent=self.text,
                  initialvalue=self.indentwidth,
                  minvalue=2,
                  maxvalue=16)
        if new and new != self.indentwidth and not self.usetabs:
            self.indentwidth = new
        return "break" 
Example #19
Source File: EditorWindow.py    From Fluid-Designer with GNU General Public License v3.0 5 votes vote down vote up
def goto_line_event(self, event):
        text = self.text
        lineno = tkSimpleDialog.askinteger("Goto",
                "Go to line number:",parent=text)
        if lineno is None:
            return "break"
        if lineno <= 0:
            text.bell()
            return "break"
        text.mark_set("insert", "%d.0" % lineno)
        text.see("insert") 
Example #20
Source File: gui_nothreads.py    From Pyro5 with MIT License 5 votes vote down vote up
def button_msgbox_clicked(self):
        # this button event handler is here only to show that gui events are still processed normally
        number = simpledialog.askinteger("A normal popup", "Hi there enter a number", parent=self.tk) 
Example #21
Source File: gui_threads.py    From Pyro5 with MIT License 5 votes vote down vote up
def button_msgbox_clicked(self):
        # this button event handler is here only to show that gui events are still processed normally
        number = simpledialog.askinteger("A normal popup", "Hi there enter a number", parent=self.tk) 
Example #22
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