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


Python Interface.mode方法代码示例

本文整理汇总了Python中interface.Interface.mode方法的典型用法代码示例。如果您正苦于以下问题:Python Interface.mode方法的具体用法?Python Interface.mode怎么用?Python Interface.mode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在interface.Interface的用法示例。


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

示例1: main

# 需要导入模块: from interface import Interface [as 别名]
# 或者: from interface.Interface import mode [as 别名]
def main():
    pygame.init()  # Инициация PyGame, обязательная строчка
    screen = pygame.display.set_mode(DISPLAY)  # Создаем окошко
    pygame.display.set_caption("Alert system")  # Пишем в шапку
    clock = pygame.time.Clock()
    fps = 30

    interface = Interface(BACKGROUND_COLOR, DISPLAY)

    while 1:  # Основной цикл программы
        for e in pygame.event.get():  # Обрабатываем события
            keys = pygame.key.get_pressed()
            if keys[pygame.K_f]:
                interface.mode = interface.FIRE_MODE
            elif keys[pygame.K_c]:
                interface.mode = interface.CHEM_MODE
            elif keys[pygame.K_v]:
                interface.mode = interface.INACTIVE_MODE
            if True in mouse.get_pressed():
                pos = mouse.get_pos()
                if pos[0] < 1000:
                    interface.new_object(pos)
            if e.type == QUIT:
                raise SystemExit("QUIT")
        interface.update()
        screen.blit(interface.image, (0, 0))  # Каждую итерацию необходимо всё перерисовывать
        pygame.display.update()  # обновление и вывод всех изменений на экран
        clock.tick_busy_loop(fps)
开发者ID:th13f,项目名称:alert_system,代码行数:30,代码来源:main.py

示例2: iwconfig

# 需要导入模块: from interface import Interface [as 别名]
# 或者: from interface.Interface import mode [as 别名]
def iwconfig():
    devnull = open(os.devnull, 'w')
    lst = []

    cmd = Popen(['iwconfig'], stdout=PIPE, stderr=devnull)
    for line in cmd.communicate()[0].split('\n\n'):
        tmpiface = Interface(None, None, None, None)
        line = line.strip()

        if len(line) == 0:
            continue

        ifname = re.search('^([A-Za-z0-9]+)', line)
        ifessid = re.search('ESSID:"([A-Za-z0-9]+)"', line)
        ifmode = re.search('Mode:([A-Za-z]+)', line)
        ifbssid = re.search('Access Point: ([0-9:A-F]+)', line)

        if ifname is not None:
            tmpiface.name = ifname.group(1)

            if ifessid is not None:
                tmpiface.essid = ifessid.group(1)

            if ifmode is not None:
                tmpiface.mode = ifmode.group(1)

            if ifbssid is not None:
                tmpiface.bssid = ifbssid.group(1)

            lst.append(tmpiface)

    devnull.close()
    return lst
开发者ID:ShaneHarvey,项目名称:wepcracker,代码行数:35,代码来源:sniffer.py

示例3: new_interface

# 需要导入模块: from interface import Interface [as 别名]
# 或者: from interface.Interface import mode [as 别名]
 def new_interface(self, server, socket):
     self.add_recent_server(server)
     interface = Interface(server, socket)
     interface.mode = 'checkpoint'
     self.interfaces[server] = interface
     self.request_header(interface, self.blockchain.checkpoint_height)
     if server == self.default_server:
         self.switch_to_interface(server)
     self.notify('interfaces')
开发者ID:nomnombtc,项目名称:electrum,代码行数:11,代码来源:network.py

示例4: new_interface

# 需要导入模块: from interface import Interface [as 别名]
# 或者: from interface.Interface import mode [as 别名]
 def new_interface(self, server, socket):
     # todo: get tip first, then decide which checkpoint to use.
     self.add_recent_server(server)
     interface = Interface(server, socket)
     interface.blockchain = None
     interface.tip = 0
     interface.mode = 'checkpoint'
     self.interfaces[server] = interface
     self.request_header(interface, self.get_checkpoint())
     if server == self.default_server:
         self.switch_to_interface(server)
     self.notify('interfaces')
开发者ID:samedjukic,项目名称:electrum,代码行数:14,代码来源:network.py

示例5: new_interface

# 需要导入模块: from interface import Interface [as 别名]
# 或者: from interface.Interface import mode [as 别名]
 def new_interface(self, server, socket):
     # todo: get tip first, then decide which checkpoint to use.
     self.add_recent_server(server)
     interface = Interface(server, socket)
     interface.blockchain = None
     interface.tip_header = None
     interface.tip = 0
     interface.mode = 'default'
     interface.request = None
     self.interfaces[server] = interface
     self.queue_request('blockchain.headers.subscribe', [], interface)
     if server == self.default_server:
         self.switch_to_interface(server)
开发者ID:flatfly,项目名称:electrum,代码行数:15,代码来源:network.py


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