• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python simpledialog.askstring函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中tkinter.simpledialog.askstring函数的典型用法代码示例。如果您正苦于以下问题:Python askstring函数的具体用法?Python askstring怎么用?Python askstring使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了askstring函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: before_write_instru_info

    def before_write_instru_info(self, instru_info: InstruInfoComponent):
        super().before_write_instru_info(instru_info)
        root = Tk()
        root.withdraw()

        name = simpledialog.askstring("Action", "Enter NDAR instrument name (without version and not case sensitive)")
        version = simpledialog.askstring("Action", "Enter NDAR instrument version")
        respondent = simpledialog.askstring("Action", "Enter the respondent for this instrument. (e.g, twin, cotwin)")

        if name is not None:
            # No input check right now
            name = name.lower()
            instru_info.instru_info.instru_name = name
            self.instru_info.instru_name = name

        if version is not None:
            # A '0' is added to the version string because NDAR requires
            # single digit versions numbers to have a leading '0'
            if len(version) == 1:
                version = "0" + version
            instru_info.instru_info.version = version
            self.instru_info.version = version

        if respondent is not None:
            instru_info.instru_info.respondent = respondent
            self.instru_info.respondent = respondent

        root.destroy()
开发者ID:rrlittle,项目名称:rocket,代码行数:28,代码来源:wtp2ndar.py


示例2: CheckServiceAvailability_Button

 def CheckServiceAvailability_Button(self):
     Input_Date_value = simpledialog.askstring("test","Please enter date for reservation: ") 
     Input_Time_value = simpledialog.askstring("test","Please enter time for reservation: ")
     InputService_value = simpledialog.askstring("test","Which services do you want?")
 
     CheckServiceAvailabilityInstance = CheckServiceAvailability(Input_Date_value, Input_Time_value, InputService_value)
     CheckServiceAvailabilityInstance.Check()
开发者ID:jennyapple123,项目名称:IST303_GroupProject_MW,代码行数:7,代码来源:IST303Project.py


示例3: DislayAvailableService_Button

 def DislayAvailableService_Button(self):
    # Input the information
     Input_Date_value = simpledialog.askstring("test","Please enter date: ") 
     Input_StartTime_value = simpledialog.askstring("test","Please enter start time: ")
     
     AS = AvailableService(Input_Date_value, Input_StartTime_value)
     AS.Check()
开发者ID:jennyapple123,项目名称:IST303_GroupProject_MW,代码行数:7,代码来源:IST303Project.py


示例4: setMultiplayer

def setMultiplayer():
   global gameTypeAi, client, playersTurn, oppositePlayer
   gameTypeAi = False

   root = Tk()
   root.withdraw()
   root.resizable(0,0)
   #Ask the user for an ip address and a port, if blank set to 'localhost' and '12345'
   ip = str(sd.askstring("IP Address", "Enter the ip address you want to connect to"))
   port1 = sd.askstring("Port Number", "Enter the port number you want to connect to")
   if (ip == ""):
       ip = 'localhost'
   if (port1 == ""):
       port1 = 12345

   #Server Connections
   client = socket.socket()
   port = int(port1)
   client.connect((ip, port))
   #Receive a message from the server defining which player you are 'X' or 'O'
   assign = client.recv(1024)
   assign = assign.decode('utf-8').rstrip('\r\n')
   if assign == "X":
       playersTurn = "X"
       oppositePlayer = "O"
   elif assign == "O":
       playersTurn = "O"
       oppositePlayer = "X"

   print("You are player " + playersTurn)
   header.configure(text="Tic Tac Toe\nYou are player " + playersTurn)
   #'X' goes first to if you are 'O' the you have to wait by going straight to the recMove function
   if playersTurn == "O":
       recMove()
开发者ID:calum1904,项目名称:TicTacToe,代码行数:34,代码来源:Tic+Tac+Toe.py


示例5: add_extra_content_to_data_table

    def add_extra_content_to_data_table(self, data_table):

        # Read in multiple data tables
        data_table_names = []
        # while True:
        #     data_table_name = input("Which database tables are you going to pull data from (press Enter to end): ")
        #     if data_table_name == "":
        #         break
        #     data_table_names.append(data_table_name)
        root = Tk()
        root.withdraw()

        data_table_name = simpledialog.askstring("Action",
                                                 "Add datatable name for this template. Press cancel to end inputting")

        while True:
            if data_table_name is None:
                break
            data_table_names.append(data_table_name)
            data_table_name = simpledialog.askstring("Action",
                                                     "Add another datatable name for this template. Press cancel to end inputting")

        root.destroy()
        content = ["", data_table.DATA_TABLE_KEY] + data_table_names
        data_table.content.append(content)
        self.source.data_table_names = data_table_names
开发者ID:rrlittle,项目名称:rocket,代码行数:26,代码来源:wtp2ndar.py


示例6: make_widgets

 def make_widgets(self):
     MLabel(self, text='简单对话框演示')
     self.label = MLabel(self, text='等待测试...')
     MButton(self, text="输入字符串",
             command=lambda: self.print_result(simpledialog.askstring('Input', 'Your name: ')))
     MButton(self, text="输入整数",
             command=lambda: self.print_result(simpledialog.askstring('Input', 'Your age: ')))
     MButton(self, text="输入浮点数",
             command=lambda: self.print_result(simpledialog.askstring('Input', 'Your height: ')))
开发者ID:ChrisLeeGit,项目名称:programming-python-code-set,代码行数:9,代码来源:standard-dialogs.py


示例7: AvailableTimeForService_Button

    def AvailableTimeForService_Button(self):
        InputService_value = simpledialog.askstring("test","Which services do you want?")
        Start_Date_value = simpledialog.askstring("test","Please enter start date: ") 
        Start_Time_value = simpledialog.askstring("test","Please enter start time: ")
        End_Date_value = simpledialog.askstring("test","Please enter end date: ") 
        End_Time_value = simpledialog.askstring("test","Please enter end time: ")
        length_value = simpledialog.askinteger("test", "For how long?")

        AvailableTimeForServiceInstance = AvailableTimeForService(Start_Date_value, Start_Time_value,End_Date_value, End_Time_value, InputService_value, length_value)
开发者ID:jennyapple123,项目名称:IST303_GroupProject_MW,代码行数:9,代码来源:IST303Project.py


示例8: 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:JohnDoes95,项目名称:project_parser,代码行数:10,代码来源:tksupport.py


示例9: reserve_Button

    def reserve_Button(self):
        # Input the information
        input_id_value = simpledialog.askinteger("test", "Please enter customer ID: ")
        Input_Date_value = simpledialog.askstring("test","Please enter date for reservation: ") 
        Input_Time_value = simpledialog.askstring("test","Please enter time for reservation: ")
        InputService_value = simpledialog.askstring("test","Which services do you want?")
        length_value = simpledialog.askinteger("test", "For how long?")

        ServiceObject = eval(InputService_value)
        ServiceObject.reserve(input_id_value, Input_Date_value, Input_Time_value, length_value, InputService_value)
开发者ID:jennyapple123,项目名称:IST303_GroupProject_MW,代码行数:10,代码来源:IST303Project.py


示例10: go_to_lilis_parsing

 def go_to_lilis_parsing(self):
     """how many artist do you want to parse"""
     number_from = simpledialog.askstring('Number', 'How many artists?/FROM')
     if number_from is not None:
         number_from = int(number_from)
     print(number_from)
     number_to = int(simpledialog.askstring('Number', 'How many artists?/TO'))
     if number_to is not None:
         number_to = int(number_to)
     print(number_to)
     self.db_creator.parse_file(number_to, number_from)
开发者ID:Monk-,项目名称:PyMeno,代码行数:11,代码来源:gui.py


示例11: saveas_command

    def saveas_command(p):
        new_target = filedialog.asksaveasfilename(defaultextension='.etxt', filetypes=[(s_Document, '*.etxt'),], title=s_MenuFileSave)
        if not new_target: return
        p.password = None
        
        pw1, pw2 = 1, 2
        while pw1 != pw2:
            pw1 = simpledialog.askstring("Passphrase", s_AskPassword+s_Password, show='*')
            # Annulla il loop con la prima pw vuota
            if pw1 == '': return
            pw2 = simpledialog.askstring("Passphrase", s_RepeatPassword+s_Password, show='*')

        p.password = pw1
        p.target_etxt = new_target
        p.save_command()
开发者ID:vsoljan,项目名称:CryptoPad,代码行数:15,代码来源:CryptoPad.py


示例12: menuMessage

    def menuMessage(self, event=None):

        # Dialog box asking for date, and then print the epoch in the text filename
        date = str(simpledialog.askstring("Special Message", "How long would you like the message to remain on the home page?\n(Please type a date in this exact format: 'June 3, 2016')."))
        if date == 'None':
            pass
        else:
            try:
                pattern = '%B %d, %Y'      
                epoch = int(time.mktime(time.strptime(date, pattern)))
                filename = 'message{}.txt'.format(epoch)

                # Get rid of previous message text files
                for file in glob.glob("message*.txt"):
                    os.remove(file)
                    
                # Open the new text file in Notepad with boilerplate instructions already inserted
                file = open(filename, 'a')
                file.write(
                    '<!--\n\nType the HTML code for your message below, and then save and close the text file.\n'
                    'The message will appear above the upcoming movies next time you update the website,\n'
                    'and will remain there until the date you specified.\n\n'
                    '(These instructions will not appear on the website.)\n\n-->')
                file.close()
                os.system('start '+filename)
            except:
                self.wrongFormat()
开发者ID:nathanreinauer,项目名称:Python-Again,代码行数:27,代码来源:Sunset.py


示例13: setCLCWcallback

 def setCLCWcallback(self):
   """Called when the SetCLCW menu entry is selected"""
   clcwStr = simpledialog.askstring(title="CLCW Dialog",
                                    prompt="CLCW Report Value (0...255):",
                                    initialvalue="0")
   if clcwStr != None:
     self.notifyModelTask(["SETCLCW", clcwStr])
开发者ID:Stefan-Korner,项目名称:SpacePyLibrary,代码行数:7,代码来源:LINKgui.py


示例14: askstring

 def 標記取代(self,event=None):
     """
     抓取所選取範圍的單字並默認其為查詢的預設字
     根據使用者輸入字串查詢目前游標所在的文件區塊
     將查詢結果全部標記
     文件區根據目前焦點決定(都沒有則為文件區1)
     """
     focused_on = self.root.focus_get()
     文字區= "文件區1" if focused_on == self.text else "文件區2" 
     if focused_on != self.text and focused_on != self.text2:
         focused_on = self.text
         文字區= "文件區1" 
     target = askstring('取代...', '將標記取代為?',initialvalue="變數名")
     記數=0
     if target != None:
         標記範圍= focused_on.tag_ranges("查詢字")
         for i in range(len(標記範圍)-1,0,-2):
             記數+=1
             focused_on.delete(標記範圍[i-1],標記範圍[i])
             focused_on.insert(標記範圍[i-1],target)
             endpos=str(標記範圍[i-1])+'+%dc' % len(target)
             # print(endpos)
             focused_on.tag_add("查詢字", 標記範圍[i-1],endpos )
             focused_on.tag_config("查詢字", background="yellow", foreground="blue")
         
     if 記數!= 0:
         messagebox.showinfo('取代...','總共取代為 %s 共有 %d 個'%(target,記數))
         self.輸出結果.config(text="%s將標記字串取代為%s"%(文字區,target),fg= "black")
     else:
         self.輸出結果.config(text="%s無要取代的文字"%(文字區),fg= "black")
开发者ID:renyuanL,项目名称:Turtle_tc_GUI,代码行数:30,代码来源:Turtle_GUI.py


示例15: getid

    def  getid(self, event):
        if not self.br_state:
            return
        
        self.id_input_status=True
        pid = simpledialog.askstring('员工编号','请输入8位ID')
        if pid is None or len(pid)==0:
            return

        try:
            card_id=EmployeeCardInfo.get((EmployeeCardInfo.employee==pid)&(EmployeeCardInfo.is_active==True)).card
            self.card_id.set(card_id)
        except EmployeeCardInfo.DoesNotExist:
            self.card_id.set('None')
            #messagebox.showwarning("提示", "数据库中没有阁下的ID card的记录,请通知管理员添加") 
                
        try:                
            employee_line= Employee.get(Employee.employee==pid)
            self.num_counter=30
            self.c_status=True
        except Employee.DoesNotExist:
            self.c_status=False
            self.card_id.set("")
            self.employee_info.set("")
            self.s_user=""
            messagebox.showerror("错误", "数据库中无阁下相关信息,请通知管理员增加人员信息")
            return
            
        self.id_input_status=False            
    
        self.s_user=employee_line.employee+"-"+employee_line.name
        self.employee_info.set(self.s_user)            
开发者ID:mikewolfli,项目名称:contract_manager,代码行数:32,代码来源:main.py


示例16: paramClicked

 def paramClicked(self, param, nodeID):
   """callback when a Param node is clicked"""
   innerTree = self.tree()
   if param.isReadOnly():
     return
   nodeKey = innerTree.item(nodeID, "text")
   nodeValues = innerTree.item(nodeID, "value")
   name = nodeValues[0]
   value = nodeValues[1]
   paramType = param.getParamType()
   if paramType == UTIL.DU.BITS or paramType == UTIL.DU.SBITS or \
      paramType == UTIL.DU.UNSIGNED or paramType == UTIL.DU.SIGNED:
     answer = simpledialog.askinteger("Integer Parameter",
                                      nodeKey + ": " + name,
                                      parent=self,
                                      initialvalue=value)
   elif paramType == UTIL.DU.BYTES or paramType == UTIL.DU.FLOAT or \
        paramType == UTIL.DU.TIME or paramType == UTIL.DU.STRING:
     answer = simpledialog.askstring("String Parameter",
                                     nodeKey + ": " + name,
                                     parent=self,
                                     initialvalue=value)
   else:
     answer = None
   if answer == None:
     return
   # new parameter value entered --> update param object and tree
   newValue = answer
   param.value = newValue
   innerTree.set(nodeID, 1, newValue)
开发者ID:Stefan-Korner,项目名称:SpacePyLibrary,代码行数:30,代码来源:VPgui.py


示例17: do_edit_link

 def do_edit_link (self, tag):
     """
         effective procedure for editing a relationship link label;
     """
     # param controls
     if self.TAG_RADIX_LINK in tag:
         # inits
         _group = self.canvas_groups[tag]
         _text_id = _group["text"]
         _name0 = self.get_name_from_tag(_group["tag0"])
         _name1 = self.get_name_from_tag(_group["tag1"])
         # get new text
         _new_text = SD.askstring(
             _("Characters relationship"),
             _("Relationship '{from_name}' <---> '{to_name}'")
             .format(from_name=_name0, to_name=_name1),
             initialvalue=self.itemcget(_text_id, "text"),
             parent=self,
         )
         # got something?
         if _new_text:
             # update label
             self.update_label(_group, text=_new_text)
             # update canvas
             self.update_canvas()
开发者ID:PabloSajnovsky,项目名称:tkScenarist,代码行数:25,代码来源:characters_canvas.py


示例18: add_Sheet

    def add_Sheet(self, sheetname=None, sheetdata=None):
        """Add a new sheet - handles all the table creation stuff"""

        def checksheet_name(name):
            if name == '':
                messagebox.showwarning("Whoops", "Name should not be blank.")
                return 0
            if name in self.sheets:
                messagebox.showwarning("Name exists", "Sheet name already exists!")
                return 0
        names = [self.notebook.tab(i, "text") for i in self.notebook.tabs()]
        noshts = len(names)
        if sheetname == None:
            sheetname = simpledialog.askstring("New sheet name?", "Enter sheet name:",
                                                initialvalue='sheet'+str(noshts+1))
        checksheet_name(sheetname)
        page = Frame(self.notebook)
        self.notebook.add(page, text=sheetname)
        #Create the table and model if data present
        if sheetdata != None:
            model = TableModel(sheetdata)
            self.currenttable = MyTable(page, model)
        else:
            self.currenttable = MyTable(page)

        #Load preferences into table
        self.currenttable.loadPrefs(self.preferences)
        #This handles all the canvas and header in the frame passed to constructor
        self.currenttable.createTableFrame()
        #add the table to the sheet dict
        self.sheets[sheetname] = self.currenttable
        self.saved = 0
        return sheetname
开发者ID:dmnfarrell,项目名称:tkintertable,代码行数:33,代码来源:App.py


示例19: savePreset

def savePreset(main, filename=None):

    if filename is None:
        root = Tk()
        root.withdraw()
        filename = simpledialog.askstring(title='Save preset',
                                          prompt='Save config file as...')
        root.destroy()

    if filename is None:
        return

    config = configparser.ConfigParser()
    fov = 'Field of view'
    config['Camera'] = {
        'Frame Start': main.frameStart,
        'Shape': main.shape,
        'Shape name': main.tree.p.param(fov).param('Shape').value(),
        'Horizontal readout rate': str(main.HRRatePar.value()),
        'Vertical shift speed': str(main.vertShiftSpeedPar.value()),
        'Clock voltage amplitude': str(main.vertShiftAmpPar.value()),
        'Frame Transfer Mode': str(main.FTMPar.value()),
        'Cropped sensor mode': str(main.cropParam.value()),
        'Set exposure time': str(main.expPar.value()),
        'Pre-amp gain': str(main.PreGainPar.value()),
        'EM gain': str(main.GainPar.value())}

    with open(os.path.join(main.presetDir, filename), 'w') as configfile:
        config.write(configfile)

    main.presetsMenu.addItem(filename)
开发者ID:fedebarabas,项目名称:tormenta,代码行数:31,代码来源:guitools.py


示例20: parameterSelected

 def parameterSelected(self, selectPos):
   """Callback when a parameter is selected"""
   tmParamExtraction = self.tmParamExtractions[selectPos]
   name = tmParamExtraction.name
   descr = tmParamExtraction.descr
   paramType = tmParamExtraction.valueType
   value = self.tmParamValues[selectPos]
   if paramType == UTIL.DU.BITS or paramType == UTIL.DU.SBITS or \
      paramType == UTIL.DU.UNSIGNED or paramType == UTIL.DU.SIGNED:
     answer = simpledialog.askinteger("Integer Parameter",
                                      descr + ": " + name,
                                      parent=self,
                                      initialvalue=value)
   elif paramType == UTIL.DU.BYTES or paramType == UTIL.DU.FLOAT or \
        paramType == UTIL.DU.TIME or paramType == UTIL.DU.STRING:
     answer = simpledialog.askstring("String Parameter",
                                     descr + ": " + name,
                                     parent=self,
                                     initialvalue=value)
   else:
     answer = None
   if answer == None:
     return
   # new parameter value entered --> update param value entry and list
   newValue = answer
   self.tmParamValues[selectPos] = newValue
   text = tmParamExtraction.descr + ": " + tmParamExtraction.name + " = " + str(newValue)
   self.parametersListbox.list().delete(selectPos)
   self.parametersListbox.list().insert(selectPos, text)
开发者ID:Stefan-Korner,项目名称:SpacePyLibrary,代码行数:29,代码来源:SPACEgui.py



注:本文中的tkinter.simpledialog.askstring函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python support.root_deiconify函数代码示例发布时间:2022-05-27
下一篇:
Python simpledialog.askinteger函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap