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


Python simpledialog.askinteger方法代碼示例

本文整理匯總了Python中tkinter.simpledialog.askinteger方法的典型用法代碼示例。如果您正苦於以下問題:Python simpledialog.askinteger方法的具體用法?Python simpledialog.askinteger怎麽用?Python simpledialog.askinteger使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在tkinter.simpledialog的用法示例。


在下文中一共展示了simpledialog.askinteger方法的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: n_step_random_command

# 需要導入模塊: from tkinter import simpledialog [as 別名]
# 或者: from tkinter.simpledialog import askinteger [as 別名]
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 
開發者ID:mahdavipanah,項目名稱:pynpuzzle,代碼行數:28,代碼來源:pynpuzzle.py

示例2: numinput

# 需要導入模塊: from tkinter import simpledialog [as 別名]
# 或者: from tkinter.simpledialog import askinteger [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

示例3: button_msgbox_clicked

# 需要導入模塊: from tkinter import simpledialog [as 別名]
# 或者: from tkinter.simpledialog import askinteger [as 別名]
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) 
開發者ID:irmen,項目名稱:Pyro5,代碼行數:5,代碼來源:gui_threads.py

示例4: goto_line_event

# 需要導入模塊: from tkinter import simpledialog [as 別名]
# 或者: from tkinter.simpledialog import askinteger [as 別名]
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") 
開發者ID:Microvellum,項目名稱:Fluid-Designer,代碼行數:13,代碼來源:EditorWindow.py

示例5: change_indentwidth_event

# 需要導入模塊: from tkinter import simpledialog [as 別名]
# 或者: from tkinter.simpledialog import askinteger [as 別名]
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" 
開發者ID:Microvellum,項目名稱:Fluid-Designer,代碼行數:13,代碼來源:EditorWindow.py

示例6: _asktabwidth

# 需要導入模塊: from tkinter import simpledialog [as 別名]
# 或者: from tkinter.simpledialog import askinteger [as 別名]
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). 
開發者ID:Microvellum,項目名稱:Fluid-Designer,代碼行數:15,代碼來源:EditorWindow.py

示例7: dewow

# 需要導入模塊: from tkinter import simpledialog [as 別名]
# 或者: from tkinter.simpledialog import askinteger [as 別名]
def dewow(self,proj):
        window = sd.askinteger("Input","Dewow window width (number of samples)")
        if window is not None:
            proj.dewow(window=window) 
開發者ID:NSGeophysics,項目名稱:GPRPy,代碼行數:6,代碼來源:gprpyGUI.py

示例8: smooth

# 需要導入模塊: from tkinter import simpledialog [as 別名]
# 或者: from tkinter.simpledialog import askinteger [as 別名]
def smooth(self,proj):
        window = sd.askinteger("Input","Smoothing window width (number of samples)")
        if window is not None:
            proj.smooth(window=window) 
開發者ID:NSGeophysics,項目名稱:GPRPy,代碼行數:6,代碼來源:gprpyGUI.py

示例9: remMeanTrace

# 需要導入模塊: from tkinter import simpledialog [as 別名]
# 或者: from tkinter.simpledialog import askinteger [as 別名]
def remMeanTrace(self,proj):
        ntraces = sd.askinteger("Input","Remove mean over how many traces?")
        if ntraces is not None:
            proj.remMeanTrace(ntraces=ntraces) 
開發者ID:NSGeophysics,項目名稱:GPRPy,代碼行數:6,代碼來源:gprpyGUI.py

示例10: agcGain

# 需要導入模塊: from tkinter import simpledialog [as 別名]
# 或者: from tkinter.simpledialog import askinteger [as 別名]
def agcGain(self,proj):
        window = sd.askinteger("Input","Window length for AGC?")
        if window is not None:
            proj.agcGain(window=window) 
開發者ID:NSGeophysics,項目名稱:GPRPy,代碼行數:6,代碼來源:gprpyGUI.py

示例11: profileSmooth

# 需要導入模塊: from tkinter import simpledialog [as 別名]
# 或者: from tkinter.simpledialog import askinteger [as 別名]
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) 
開發者ID:NSGeophysics,項目名稱:GPRPy,代碼行數:8,代碼來源:gprpyGUI.py

示例12: smooth

# 需要導入模塊: from tkinter import simpledialog [as 別名]
# 或者: from tkinter.simpledialog import askinteger [as 別名]
def smooth(self,proj):
        window = sd.askinteger("Input",
                               "Smoothing window width (number of samples)")
        if window is not None:
            proj.smooth(window=window) 
開發者ID:NSGeophysics,項目名稱:GPRPy,代碼行數:7,代碼來源:gprpyCWGUI.py

示例13: printFigures

# 需要導入模塊: from tkinter import simpledialog [as 別名]
# 或者: from tkinter.simpledialog import askinteger [as 別名]
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])) 
開發者ID:NSGeophysics,項目名稱:GPRPy,代碼行數:33,代碼來源:gprpyCWGUI.py


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