本文整理汇总了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
示例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
示例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)
示例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")
示例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"
示例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).
示例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)
示例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)
示例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)
示例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)
示例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)
示例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)
示例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]))