当前位置: 首页>>代码示例>>Python>>正文


Python simpledialog.askstring函数代码示例

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


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


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