本文整理汇总了Python中tkSimpleDialog.askstring函数的典型用法代码示例。如果您正苦于以下问题:Python askstring函数的具体用法?Python askstring怎么用?Python askstring使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了askstring函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: funciontxt
def funciontxt():
#Pedir nombre de archivo, no puede ser nulo
nombre = tkSimpleDialog.askstring('Archivo','Ingrese el nombre con el que desea guardar su archivo: ')
while nombre == "":
nombre = tkSimpleDialog.askstring('Archivo','Ingrese un nombre. No se pueden nombres vacios.')
#concatena la extension de archivo
nombre = nombre + '.txt'
root = tk.Tk()
root.withdraw()
lista=[]
#conversion de archivo a documento de texto
while True:
filename = tkFileDialog.askopenfilename()
try:
im = Image.open(filename)
text=image_to_string(im)
f=open(nombre,"w")
f.write(text)
f.close()
tkMessageBox.showinfo('INFORMACION', 'Su archivo con el nombre "'+nombre+'". Se ha creado con exito')
break
except:
tkMessageBox.showwarning("Open file","Ingrese un archivo de imagen")
break
x = 0
开发者ID:xgx945-HHU,项目名称:ocr-uvg,代码行数:25,代码来源:proyecto3(FINAL).py
示例2: opponent_pick_logic
def opponent_pick_logic(self, opponent_id):
pick_made = False
pick = tkSimpleDialog.askstring(
"Opponent's pick",
"Who did your opponent pick?\nCurrent Pick: Round {0}: Pick {1}"
.format(self.game.current_round, self.game.current_position))
while not pick_made:
try:
if utils.get_player_position(pick, self.game.cursor) is not None:
position = utils.get_player_position(pick, self.game.cursor).rstrip('0123456789 ').upper()
if utils.get_player_from_table(pick, position, self.game.cursor) is not None:
utils.remove_player_from_possible_players(pick, self.game.connection, self.game.cursor)
opponent = [opponent for opponent in self.game.opponents if opponent_id == opponent.id][0]
opponent.team.append(pick)
pick_made = True
else:
pick = tkSimpleDialog.askstring(
"Opponent's pick",
"NOT A VALID PICK: please select again\nCurrent Pick: Round {0}: Pick {1}"
.format(self.game.current_round, self.game.current_position))
else:
pick = tkSimpleDialog.askstring(
"Opponent's pick",
"NOT A VALID PICK: please select again\nCurrent Pick: Round {0}: Pick {1}"
.format(self.game.current_round, self.game.current_position))
except AttributeError:
tkMessageBox.showinfo("Error", "Opponent must pick a valid player")
pick = tkSimpleDialog.askstring(
"Opponent's pick",
"NOT A VALID PICK: please select again\nCurrent Pick: Round {0}: Pick {1}"
.format(self.game.current_round, self.game.current_position))
开发者ID:BarnettMichael,项目名称:FantasyFootballHelper,代码行数:34,代码来源:FFHGui.py
示例3: userInput
def userInput():
#Ask creator of demo/sandbox information for first name, last name, and email address:
first = tkSimpleDialog.askstring("First Name", "What is the person's first name?")
last = tkSimpleDialog.askstring("Last Name", "What is the person's last name?")
mail = tkSimpleDialog.askstring("Email", "What is the person's email address (omit @centurylink.com)?")
#Take the data from inputs and assign them to other variables.
master = first + "." + last + ".sandbox"
inbox = mail + "@centurylink.com"
#Authenication API call for CLC in CCTS.
clc.v1.SetCredentials("a89492344bc24fccb1f8bfd8033d28ed","iI_P:Hc`ylb1sLma")
#Create User API call for CLC in CCTS.
clc.v1.User.CreateUser(user=master,email=inbox,first_name=first,last_name=last,roles=["ServerAdministrator","NetworkManager","AccountViewer"],alias="CCTS")
#Create additional variables to the display the information back to the creator of the demo account.
output = "Demo account successfully created in CCTS."
output1 = """{0} is the person's first name.""" .format(first)
output2 = """{0} is the person's last name.""" .format(last)
output3 = """Persons username is {0}.""" .format(master)
output4 = """{0} is the person's email address.""" .format(inbox)
output5 = "The user's permissions are Server Administrator, Network Manager, and Account Viewer."
#Display output back to the creator.
tkMessageBox.showinfo("Results", output)
tkMessageBox.showinfo("Results", output1)
tkMessageBox.showinfo("Results", output2)
tkMessageBox.showinfo("Results", output3)
tkMessageBox.showinfo("Results", output4)
tkMessageBox.showinfo("Results", output5)
return
开发者ID:Andrew-Nielsen,项目名称:Demo-Sandbox,代码行数:32,代码来源:CCTS.py
示例4: changeMastKey
def changeMastKey(self):
self.checkpoint()
attempt1 = tkSimpleDialog.askstring('new master key','Enter the new master key:',show='*')
if len(attempt1) < 4:
tkMessageBox.showinfo('failure','minimum length of master key is 4 charachters')
self.initFrameAndButtons()
return
attempt2 = tkSimpleDialog.askstring('confirm new master key','Re-enter the new master key:',show='*')
if not attempt1 == attempt2:
tkMessageBox.showinfo('Failure','The two master keys you entered are not the same. \
\nThe master key was not changed. \nTry again.')
self.initFrameAndButtons()
return False
inFile = open('mast','w')
attempt1 = attempt1 + salt
att = sha1(attempt1)
att = att.hexdigest()
inFile.write(att)
inFile.close()
self.initFrameAndButtons()
开发者ID:icyflame,项目名称:VIPER41,代码行数:33,代码来源:viper41.py
示例5: getShortestDistance
def getShortestDistance(self):
'''
# Function to get call SSSP after asking user for source and destination cities
:return:
'''
source_name = tkSimpleDialog.askstring("City name", "Please enter source city name")
if source_name is None or self.g.getVertexByName(source_name) is None:
if source_name is not None: tkMessageBox.showwarning("Name invalid", "City name is not valid")
return
dest_name = tkSimpleDialog.askstring("City name", "Please enter destination city name")
if dest_name is None or self.g.getVertexByName(dest_name) is None:
if dest_name is not None: tkMessageBox.showwarning("Name invalid", "City name is not valid")
return
source = self.g.getVertexByName(source_name)
dest = self.g.getVertexByName(dest_name)
self.g.findSSSP(source)
list = []
current_vertex = dest
while current_vertex is not source:
list.append(current_vertex.name)
current_vertex = current_vertex.pred
list.append(current_vertex.name)
# then we reverse the list
list.reverse()
# DEGGING
print list
# DEBUGGING
self.g.getRouteInfoFromList(list)
开发者ID:lkhamsurenl,项目名称:graph-data-structure,代码行数:30,代码来源:GUI.py
示例6: promptSession
def promptSession(self):
''' Prompts the experimenter for the Subject ID, Session ID,
and the number of repetitions
'''
while (True):
self.setRepetitions()
self.specifySequence()
participantId = askstring(' ','Please enter Subject ID:')
if participantId == None:
sys.exit()
sessionId = askstring(' ','Please enter Session ID:')
if sessionId == None:
sys.exit()
sequence = self.sequenceName if self.sequenceType == 'LOADED' else self.sequenceType
answer = askquestion(' ','Subject: ' + participantId + ', Session: ' + sessionId +
', Repetitions: ' + str(self.repetitions) +
', Sequence: ' + sequence + '\n\nIs this correct? ' +
'\n\n(reference CONFIG.yml file for options)')
if answer == "yes":
break
self.data = Data(participantId, sessionId) # Data collection object
开发者ID:s-pangburn,项目名称:verbal-summator,代码行数:26,代码来源:session.py
示例7: ask
def ask(prompt, default=None, title=''):
""" Get input from the user. default refers to the value which is initially in the field. Returns None on cancel."""
import tkSimpleDialog
if default:
return tkSimpleDialog.askstring(title, prompt, initialvalue=default)
else:
return tkSimpleDialog.askstring(title, prompt)
开发者ID:downpoured,项目名称:pyxels,代码行数:7,代码来源:tkutil_dialog.py
示例8: setup_engine
def setup_engine(self):
self.stockfish_depth = askstring('Stockfish Depth', 'Depth:', initialvalue=self.stockfish_depth)
self.stockfish_path = askstring('Engine Path', 'Engine Path:', initialvalue=self.stockfish_path)
setting = shelve.open(os.path.join(os.path.expanduser('~'), '.snz'))
setting['depth'] = self.stockfish_depth
setting['path'] = self.stockfish_path
setting.close()
开发者ID:iogf,项目名称:steinitz,代码行数:8,代码来源:app.py
示例9: __init__
def __init__(self, parent, qm):
self.qm = qm
keywords = [k['ID'] for k in self.qm]
self.parent = parent
self.value = []
print keywords
self.value.append(tkSimpleDialog.askstring("","Enter the question ID for which you would like to enter a default response (see terminal for question IDs)."))
self.value.append(tkSimpleDialog.askstring("", "Enter the default response to the question: %s"%self.value[0]))
开发者ID:thegricean,项目名称:lazyjournal,代码行数:8,代码来源:lazyjournal.py
示例10: lookup
def lookup(self,str_name_list):
if type(str_name_list) == tuple:
str_name_list = list(str_name_list)
print str_name_list
elif type(str_name_list) == unicode:
str_name_list = str_name_list.encode('unicode_escape')
str_name_list = re.split('} {',str_name_list)
for x in range(len(str_name_list)):
str_name_list[x] = str_name_list[x].replace('{','')
str_name_list[x] = str_name_list[x].replace('}','')
else:
print 'error in open string'
self.bibliography = list()
for name in str_name_list:
docstring = convert_pdf_to_txt(name)
if docstring != -1:
doi = return_doi(docstring)
if doi== -1:
doi = tkSimpleDialog.askstring("Enter DOI","PDF not properly converted. Enter DOI. Enter nothing to skip.")
if doi == ''or doi==None:
ref = Reference('skip___'+name,'','','', '', '' ,'')
else:
html = citation_search(doi)
if html!=-1:
ref = create_reference(html)
else:
print "citation search failed", name
# (authors,title,journal,year,volume,issue,pages)
ref = Reference('unknown___'+name,'','','', '', '' ,'')
else:
doi = tkSimpleDialog.askstring("Enter DOI","DOI not found in PDF. Enter DOI. Enter nothing to skip.")
if doi == '' or doi == None:
ref = Reference('unknown___'+name,'','','', '', '' ,'')
else:
html = citation_search(doi)
if html!=-1:
ref = create_reference(html)
else:
print "citation search failed", name
ref = Reference('','skip___'+name,'','', '', '' ,'')
ref.filepath = name
ref.url = name
self.bibliography += [ref]
self.list.insert(END,ref['title'])
print "done"
return 0
开发者ID:cmthompson,项目名称:weiss,代码行数:58,代码来源:BibMaker.py
示例11: getOpener
def getOpener(self, values):
opener_handlers = [urllib2.HTTPHandler(debuglevel = values.debug)]
if hasattr(httplib, 'HTTPS'):
opener_handlers.append(urllib2.HTTPSHandler(debuglevel = values.debug))
include = None if values.include else self.log
pSwitches = [values.post301, values.post302, values.post303]
# opener_handlers = [LogHandler(values.url)]
# opener_handlers.append(netHTTPRedirectHandler(location = values.location, include = include, postSwitches = pSwitches))
opener_handlers.append(netHTTPRedirectHandler(location = values.location, include = include, postSwitches = pSwitches))
cookie_val = None
if values.cookie_jar: cookie_val = values.cookie_jar
if values.cookie: cookie_val = values.cookie
if cookie_val != None:
cj = cookielib.LWPCookieJar()
if os.path.isfile(cookie_val): cj.load(cookie_val)
opener_handlers.append(urllib2.HTTPCookieProcessor(cj))
passwordManager = urllib2.HTTPPasswordMgrWithDefaultRealm()
if values.user:
user, password = values.user.partition(':')[0:3:2]
if not password:
try:
password = tkSimpleDialog.askstring("Enter password for " + user, "Enter password:", show='*')
except:
password = input("Enter password for " + user)
passwordManager.add_password(None, values.url, user, password)
opener_handlers.append(urllib2.HTTPBasicAuthHandler(passwordManager))
if values.auth_method == 'digest':
opener_handlers.append(urllib2.HTTPDigestAuthHandler(passwordManager))
pass
if values.proxy:
proxyStr = values.proxy
protocol, user, password, proxyhost = urllib2._parse_proxy(proxyStr)
protocol = protocol or 'http'
proxy_handler = urllib2.ProxyHandler({protocol:proxyhost})
opener_handlers.append(proxy_handler)
if not user:
if values.proxy_user:
user, password = values.proxy_user.partition(':')[0:3:2]
if user and not password:
try:
password = tkSimpleDialog.askstring("Enter proxy password for " + user, "Enter password:", show='*')
except:
input("Enter proxy password for " + user)
passwordManager.add_password(None, proxyhost, user, password)
opener_handlers.append(urllib2.ProxyBasicAuthHandler(passwordManager))
if values.proxy_auth == 'digest':
opener_handlers.append(urllib2.ProxyDigestAuthHandler(passwordManager))
pass
opener = urllib2.build_opener(*opener_handlers)
return opener
开发者ID:agmontesb,项目名称:kodiaddonide,代码行数:56,代码来源:network.py
示例12: get_constants
def get_constants():
mass = None
csArea = None
airD = None
# Loads the presets from the file
data = pickle.load(open("constants.p", "rb"))
pNames = [str(i[0]) for i in data]
# Prompt for preset or new preset
preset = tkSimpleDialog.askstring("Load Preset", "Please type a preset name or new")
if preset == 'new':
# Prompts for the object's mass
mass = tkSimpleDialog.askstring("Mass", "Type value of the object's mass(kg)")
if mass != None:
# Prompts for the object's Cross-Sectional Area
csArea = tkSimpleDialog.askstring("Cross-Sectional Area", "Type value of the object's cross-sectional area(m^2)")
if csArea != None:
# Prompts for the room's air density
airD = tkSimpleDialog.askstring("Air Density", "Type value of the room's Air Density(kg/m^3)")
if airD != None:
try: # If any of the data entered was not a number, it will throw an error
mass = float(mass)
csArea = float(csArea)
airD = float(airD)
# Asks for a name for the preset. If no name is entered, it will assign it "Temp"
name = tkSimpleDialog.askstring("Name New Preset", "What would you like to name the new preset?")
if name == None:
name = "Temp"
# If the name is already in the file, it will overwrite it
if name in pNames:
temp = pNames.index(name)
data.pop(temp)
# Adds the new preset and rewrites the file
data.append((name,[mass,csArea,airD]))
file = open("constants.p", "wb")
pickle.dump(data, file)
file.close()
except ValueError:
mass = None
print "ERROR: Values entered invalid"
else:
# If it is a preset, it will load the constants. Otherwise, it will throw an error.
if preset in pNames:
temp = data[pNames.index(preset)]
temp2 = temp[1]
mass = temp2[0]
csArea = temp2[1]
airD = temp2[2]
else:
if preset != None:
print "ERROR: ",preset,"has not been defined as a preset"
return mass, csArea, airD
开发者ID:TinyTitan,项目名称:TinyTitan-GravityExperiment,代码行数:56,代码来源:plot_Functions.py
示例13: gmail
def gmail(self): # asks for email id and password and saves them
userName = tkSimpleDialog.askstring(root,'enter email id')
password = tkSimpleDialog.askstring(root,'enter password')
file1 = open('username.txt','w')
file1.write(userName)
file2 = open('password.txt','w')
file2.write(password)
self.enable_imap()
开发者ID:serah,项目名称:Python-Ethernet-,代码行数:10,代码来源:authenticate.py
示例14: getPassword
def getPassword(prompt = '', confirm = 0):
while 1:
try1 = tkSimpleDialog.askstring('Password Dialog', prompt, show='*')
if not confirm:
return try1
try2 = tkSimpleDialog.askstring('Password Dialog', 'Confirm Password', show='*')
if try1 == try2:
return try1
else:
tkMessageBox.showerror('Password Mismatch', 'Passwords did not match, starting over')
开发者ID:TheArchives,项目名称:blockBox,代码行数:10,代码来源:tksupport.py
示例15: MenuKick
def MenuKick(Self):
target=tkSimpleDialog.askstring("Kick User", "Enter victim's nick:")
if len(target) == 0:
return
reason=tkSimpleDialog.askstring("Kick Reason", "Enter reason (if any):")
try:
if len(reason) == 0:
reason=""
server.kick(Self.ChannelName, target, reason)
except:
pass
开发者ID:swanson,项目名称:py-irc-client,代码行数:11,代码来源:client.py
示例16: specialOne
def specialOne(event):
canvas = event.widget.canvas
try:
message = "What would you like the new width to be?"
title = "Resize Video"
width = float(tkSimpleDialog.askstring(title,message))
message = "What would you like the new height to be?"
height = float(tkSimpleDialog.askstring(title,message))
resizeClip(event,width,height)
except:
canvas.create_text(canvas.width/2,10,text='Try Again')
开发者ID:Congren,项目名称:PYEdit,代码行数:11,代码来源:videoEdit.py
示例17: fetch_bonds_dialog
def fetch_bonds_dialog(app):
protein_obj = tkSimpleDialog.askstring('Object selection',
'Please enter the name of a protein object loaded in PyMOL: ',
parent=app.root)
ligand_obj = tkSimpleDialog.askstring('Object selection',
'Please enter the name of a ligand object loaded in PyMOL: ',
parent=app.root)
distance = tkSimpleDialog.askstring('Distance selection',
'Please enter a distance in Angstrom (e.g., 3.2): ',
parent=app.root)
draw_bonds(protein_obj, ligand_obj, distance)
开发者ID:rasbt,项目名称:BondPack,代码行数:12,代码来源:HydroBond.py
示例18: add_to_repertoire
def add_to_repertoire(self):
nextmove = tksd.askstring("Next Move","Enter next move:")
comments = tksd.askstring("Comments","Enter comments:")
try:
self.myrep.AddToDict(self.chessboard.export(),nextmove,comments)
except repertoire.RepertoireException as e:
print 'Exception! ', e.value
tkmb_result = tkmb.askquestion('Warning!','Do you want to overwrite this position in your repertoire?',icon='warning')
print "tkmb_result is ",tkmb_result
if tkmb_result == 'yes':
self.myrep.AddToDict(self.chessboard.export(),nextmove,comments,forceoverwrite=True)
开发者ID:kaleko,项目名称:KalekoChess,代码行数:12,代码来源:gui_tkinter.py
示例19: goToAnglesPlan
def goToAnglesPlan(self,arm):
ret=tkSimpleDialog.askstring("GoTo Angles Plan","Angles:")
if not ret: return
angles=loadAngles(ret)
planname=tkSimpleDialog.askstring("GoTo Angles Plan","Plan:")
if not planname: return
print "Planning to angles"
print angles
plan=arm.goToAngles_plan(angles,joint_tolerance_plan=self.joint_tolerance_plan.get())
savePlan(planname,plan)
print plan
print "Saved plan as "+planname
开发者ID:ysl208,项目名称:Baxter_PbD,代码行数:12,代码来源:monitor.py
示例20: specialThree
def specialThree(event):
#asks about when user wants filter to be appplied and applies it
canvas = event.widget.canvas
try:
message = "What time would you like the filter to begin??"
title = "Insert Filter"
start = float(tkSimpleDialog.askstring(title,message))
message = "What time would you like the filter to stop?"
end = float(tkSimpleDialog.askstring(title,message))
applyFilter(event,start,end)
except:
canvas.create_text(canvas.width/2,10,text='Try Again')
开发者ID:Congren,项目名称:PYEdit,代码行数:12,代码来源:videoEdit.py
注:本文中的tkSimpleDialog.askstring函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论