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


Python Input类代码示例

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


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

示例1: handleEvent

 def handleEvent(self, event):
     if event.type == pygame.KEYDOWN and event.key == pygame.K_RETURN:
         self.state += 1                
         if self.state >= len(self.inputBoxes):
             self.state = 0
             self.evalResult()
             self.setShowing(False)
             Input.get().setInDialog(False)
             for b in self.inputBoxes:
                 b.setText('')
             GUI.get().topMenu().setShowing(False)
             return 'cursor'
     elif event.type == pygame.KEYDOWN and event.key == pygame.K_ESCAPE:
         if self.state > 0:
             #self.inputBoxes[self.state].setText('')
             self.state -= 1
         else:
             self.setShowing(False)
             Input.get().setInDialog(False)
             for b in self.inputBoxes:
                 b.setText('')
             return 'cursor'
     elif event.type == pygame.KEYDOWN:
         if event.key == pygame.K_BACKSPACE:
             self.inputBoxes[self.state].delChar()
         if ((event.key >= pygame.K_0 and event.key <= pygame.K_9) or
             (event.key >= pygame.K_a and event.key <= pygame.K_z) or
             event.key == pygame.K_PERIOD or event.key == pygame.K_MINUS):
             self.inputBoxes[self.state].append(chr(event.key))
开发者ID:jemofthewest,项目名称:GalaxyMage,代码行数:29,代码来源:MapEditorSprite.py

示例2: draw

    def draw(self):
        Render.clear_layer(5)
        self.opened = True
        print self.width, self.height



        x = 5
        y = 5

        button_text = 'Close'
        button = Button(button_text,
                        self.width / 2,
                        self.height - 3,
                        function=close_window,
                        target=Render.layers['overlay_console'])

        dragging = False
        click_x = None

        mouse = Input.mouse

        while True:

            Input.update()
            Render.clear_layer(Render.layers['overlay_console'])

            Render.draw_rect(Render.layers['overlay_console'], x, y,
                             self.width,
                             self.height,
                             frame=True,
                             f_color=terminal.color_from_argb(255, 100, 100, 255),
                             bk_color=terminal.color_from_argb(192, 32, 32, 128),
                             title="POP_UP TEST!")

            Render.print_rect(Render.layers['overlay_console'], x + 2, y + 2, self.width - 4, self.height - 4, self.text)

            if mouse.lbutton and x <= mouse.cx <= x + self.width and (mouse.cy == y or dragging):
                if click_x is None:
                    click_x = mouse.cx - x
                x = mouse.cx - click_x    # (width / 2)
                y = mouse.cy
                dragging = True
            else:
                dragging = False
                click_x = None

            if button.draw(x, y) == 'close':
                self.opened = False
                Render.clear_layer(Render.layers['overlay_console'])
                return

            # libtcod.console_flush()

            # graphics.draw_image(x, y, enlarge=True)
            # graphics.draw_image(x + 1, y + 1, enlarge=True)
            # graphics.clear()
            # graphics.draw_font(0,0)

            GameState.render_ui()
开发者ID:joekane,项目名称:DeepFriedSuperNova,代码行数:60,代码来源:UI.py

示例3: testSortDependencies2

 def testSortDependencies2(self):
     cut=self.test
     i1,i2,i3,i4,i5=Input(),Input(),Input(),Input(),Input()
     i1.name,i2.name,i3.name,i4.name,i5.name='i1','i2','i3','i4','i5'
     cut.inputs={'i1':i1,'i2':i2,'i3':i3,'i4':i4,'i5':i5}
     order=cut.sortDependencies()
     assert len(order)==5,len(order)
     self.checkIfDependant(order,cut.inputs)
开发者ID:nevillegrech,项目名称:stdl,代码行数:8,代码来源:TestTest.py

示例4: testSortDependencies4

 def testSortDependencies4(self):
     cut=self.test
     i1,i2,i3,i4,i5=Input(),Input(),Input(),Input(),Input()
     i1.name,i2.name,i3.name,i4.name,i5.name='i1','i2','i3','i4','i5'
     i1.dependsOn=['i2','i4']
     i5.dependsOn=['i1']
     i4.dependsOn=['i2','i3']
     i2.dependsOn=['i3']
     i3.dependsOn=['i7']
     cut.inputs={'i1':i1,'i2':i2,'i3':i3,'i4':i4,'i5':i5}
     self.assertRaises(SemanticException,cut.sortDependencies)
开发者ID:nevillegrech,项目名称:stdl,代码行数:11,代码来源:TestTest.py

示例5: main

def main():
    # Loop until the user clicks the close button.
    done = False
    loopCount = 0
    while not done:
        loopCount += 1
        Input.update()
        if(Input.Trigger(Input.Close)):
            done = True
        map.update()
        Graphics.update()
开发者ID:BearXP,项目名称:Sumo2016_Pi,代码行数:11,代码来源:Game.py

示例6: add_data

def add_data():
    date = Input.get_date()
    temp = Input.get_temp()
    preasure = Input.get_preasure()
    humidity = Input.get_humidity()
    wspeed = Input.get_wspeed()
    wdirect = input('Enter wind direction (eg. SW or S): ')
    prec = input('Enter precipitations (eg. Rain or Snow): ')
    tmp = {date: [temp, preasure, humidity, wspeed, wdirect, prec]}
    weather.update(tmp)                                         # rewrite data that already exsist
    Open_file.save_data(weather, Configs.get_type())                                # save changes in file
    input('Press Enter to continue...')
开发者ID:VetalCoder,项目名称:Laba2_Zamyatin,代码行数:12,代码来源:W_diary.py

示例7: pushScene

 def pushScene(self, scene):
     try:
         Input.resetKeyPresses()
         ImgObj.clickableObjs = []
         if scene == "TestScene":
             scene = TestScene(self.engine)
         elif scene == "ParticleTest":
             scene = ParticleTest(self.engine)
         else:
             scene = WorldScenes.create(self.engine, scene)
         self.addScene = scene
     except ImportError:
         print scene + " has not yet been implemented or does not exist"
开发者ID:BenPerson,项目名称:UlDunAd,代码行数:13,代码来源:View.py

示例8: main

def main():

	#Input
	config=Input.load_config("appconfig.yaml")
	employee_list=Input.generate_employee_data(config,Input.get_current_payperiod())
	
	#Process
	for employee in employee_list:
		employee.process_employee_vcp()

	#Output
	print(Output.serialize(employee_list))
	Output.save_to_db(config["db_setting"],employee_list)
开发者ID:nehakhan30901,项目名称:Variable-Compensation-Plan-Process,代码行数:13,代码来源:Main.py

示例9: run

    def run(self):
        global finished

        # main event loop
        Input.update()
        self.finished = Input.finished

        self.viewport.run()
        Input.reset()
        self.clock.tick(FPS)
        self.currentFPS = int(self.clock.get_fps())
        
        #fps counter is in the title bar
        pygame.display.set_caption(caption % (self.currentFPS))
开发者ID:BenPerson,项目名称:UlDunAd,代码行数:14,代码来源:engine.py

示例10: add_data

def add_data():
#add data to our weather diary#
    date = Input.get_Date()
    temp = Input.get_temp()
    preasure = Input.get_preasure()
    humidity = Input.get_humidity()
    wspeed = Input.get_wspeed()
    wdirect = input('Enter wind direction (eg. SW or S): ')
    prec = input('Enter precipitations (eg. Rain or Snow): ')
    tmp = {date:[temp, preasure, humidity, wspeed, wdirect, prec]}
	#rewrite data that already exsist
    weather.update(tmp) 
	#save changes in file
    Open_file.save_data(weather)                               
    tmp = input('Adding/Editing Successful. Press Enter to continue...')
开发者ID:VetalCoder,项目名称:Lab1_Zamyatin,代码行数:15,代码来源:W_diary.py

示例11: getInputZMatrix

 def getInputZMatrix(self):
     try:
         data_section = re.compile("INPUT CARD.*?DATA(.*?)END", re.DOTALL).search(self.fileText).groups()[0] 
         xyz = self.getInitialXYZ()
         atom_list = []
         for atom in xyz: atom_list.append(atom[0])
         #build the regular expression
         regExp = []
         for atom in atom_list:
             regExp.append( r" INPUT CARD>(%s.*?)\n" % atom )
         regExp = "".join(regExp)
         zmat_tuple = re.compile(regExp).search(data_section).groups()
         #convert the zmat_lines into a list
         zmat_lines = []
         for entry in zmat_tuple: zmat_lines.append(entry)
         #now get anything that would be z matrix variable
         zmat_lines.append("Variables")
         regExp = "[A-Z\d]+\s*[=]\s*[-]?\d+[.]?\d*"
         vars = re.compile(regExp).findall(data_section)
         for var in vars:
             zmat_lines.append(var)
         zmat_text = "\n".join(zmat_lines)
         import Input
         atomList, zmatObject = Input.readZMatrix(zmat_text)
         return zmatObject
     except Exception, error:
         raise InfoNotFoundError("Z-Matrix")
开发者ID:jjwilke,项目名称:PySkyNet,代码行数:27,代码来源:Gamess.py

示例12: manual_input

def manual_input():
    print('-------------------------------------------------------')
    matrix = Input.insert_matrix()
    print("Matrix: ")
    Output.print_matrix(matrix)
    result = Determinant.calculate_determinant(matrix)
    print('Determinant: ' + str(Output.round_number(result)))
开发者ID:tnaftali,项目名称:determinant-solver,代码行数:7,代码来源:program.py

示例13: print_menu

def print_menu():
    # run menu
    while True:
        clear()
        print('''      Weather diary

            1. Add/Edit Element
            2. Remove Element
            3. Show data
            4. Show data by month
            5. Exit
                      ''')
        ans = Input.get_choice()                # input menu key
        if ans == 1:
            W_diary.add_data()
        elif ans == 2:
            W_diary.rm_data()
        elif ans == 3:
            Output.show_data()
        elif ans == 4:
            Output.show_data_by_month()
        elif ans == 5:
            os._exit(1)
        else:
            print('Try again')
开发者ID:VetalCoder,项目名称:Laba2_Zamyatin,代码行数:25,代码来源:Menu.py

示例14: __init__

	def __init__(self):
		self.model = None
		self.view = None
		self.running = True

		self.t = pygame.time.get_ticks()
		self.input = Input()
		self.wireframe = False
开发者ID:segonzal,项目名称:pyVoxel,代码行数:8,代码来源:Controller.py

示例15: rm_data

def rm_data():
    date = Input.get_date()
    if date in weather:
        del weather[date]
        Open_file.save_data(weather, Configs.get_type())            # save changes in file
        input('Press Enter to continue...')
    else:
        input('Day in diary not found. Press Enter to continue...')
开发者ID:VetalCoder,项目名称:Laba2_Zamyatin,代码行数:8,代码来源:W_diary.py


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