def __init__(self): simplepanel.applet.Applet.__init__(self) self.windows = Windows(ICON_SIZE) self.windows.connect('windows_changed', lambda *x: self.draw()) self.connect('click', self.click_cb) self.draw()
def container(): c = Config() database, websites = c.get_configuration() i = Initialize() browsers, dns_types = i.get_initialization() operation_system = platform.system() if operation_system == "Windows": system = Windows() elif operation_system == "Linux": system = Linux() resolver, recursive = system.get_dns_metadata() return database, websites, browsers, dns_types, resolver, recursive, system
def detect_vehicle(image, show_heat=False): windows = Windows(image.shape).windows # Uncomment the following line if you extracted training # data from .png images (scaled 0 to 1 by mpimg) and the # image you are searching is a .jpg (scaled 0 to 255) normalized_image = image.astype(np.float32) / 255 hot_windows = search_windows(normalized_image, windows, model["svc"], model["scaler"], color_space=model["color_space"], spatial_size=model["spatial_size"], hist_bins=model["hist_bins"], orient=model["orient"], pix_per_cell=model["pix_per_cell"], cell_per_block=model["cell_per_block"], hog_channel=model["hog_channel"], spatial_feat=model["spatial_feat"], hist_feat=model["hist_feat"], hog_feat=model["hog_feat"]) hot_windows = remove_false_pos(hot_windows) heat = np.zeros_like(image[:, :, 0]).astype(np.float) # Add heat to each box in box list heat = add_heat(heat, hot_windows) # Apply threshold to help remove false positives heat = apply_threshold(heat, 1) # Visualize the heatmap when displaying heatmap = np.clip(heat, 0, 255) # Find final boxes from heatmap using label function labels = label(heatmap) draw_img = draw_labeled_bboxes(image, labels) if show_heat: heatmap = np.clip(heat, 0, 255) return draw_img, heatmap, hot_windows else: return draw_img
def run_game(): pygame.init() #初始化 st = Settings() screen = pygame.display.set_mode(st.setmode) #500*600的屏幕 pygame.display.set_caption('TicTacToe') #标题 image = pygame.image.load('materials/chessboard.bmp') #载入棋盘 chess = Chess() bigchess = BigChess() retract_button = Button(screen, (170, 50, 150, 40), text='Retract') #悔棋按钮 replay_button = Button(screen, (170, 110, 150, 40), text='Replay') #重玩按钮 windows = Windows(screen, 'Replay?', 'Yes', 'No', 150, 200) while True: screen.fill(st.bg_color) #背景色 screen.blit(image, st.top_left_corner) #在棋盘左上角位置绘制棋盘,注意跟棋盘的中心位置有关 f.check_keydown(chess, bigchess, windows, screen, st, retract_button, replay_button) #检测鼠标按动 retract_button.draw_button() #绘制悔棋按钮 replay_button.draw_button() #绘制重玩按钮 f.draw(chess, bigchess, screen, windows, st) #绘制棋子,框等 pygame.display.update() #更新屏幕
images = [ Ubuntu('19.04', 'x86_64'), Ubuntu('19.04', 'arm32v7'), Ubuntu('18.04', 'x86_64'), Ubuntu('18.04', 'arm32v7'), Ubuntu('16.04', 'x86_64'), Ubuntu('16.04', 'arm32v7'), Debian('stretch', 'x86_64'), Debian('stretch', 'arm32v7'), Debian('buster', 'x86_64'), Debian('buster', 'arm32v7'), Fedora('29', 'x86_64'), Fedora('30', 'x86_64'), Fedora('31', 'x86_64'), Windows('x86_64', 'static'), ] travis = Travis(images) def create_images(): for image in images: image.write() print('Dockerfiles generated in images/\n') def filter_images(filters): if not filters: return images
def __init__(self): # *************** основное window *************** self.win_width = settings.WIDTH_WIN # Ширина окна self.win_height = settings.HEIGHT_WIN # Высота окна self.win_display = (self.win_width, self.win_height) # Компановка self.timer = pygame.time.Clock() # Таймер кадров # *************** инициализация объектов *************** self.left = self.right = self.up = self.down = self.space = False self.exit_ = True # флаг для выхода self.windows = Windows() # инициализируем Windows self.TARGET = pygame.USEREVENT self.level1 = Level(settings.LEVEL_1) # Инициализируем level1 self.level1.load_level() self.player = Player( self.level1.ret_A()) # инициализируем Tank по карте self.enemy = Enemy(self.level1.ret_B()) self.platforms = self.level1.ret_tiles() self.end = (self.player.ret_topleft()[0] / 32, self.player.ret_topleft()[1] / 32) self.start = (self.level1.ret_B()[0] / 32, self.level1.ret_B()[1] / 32) # *************** блоки спрайтов *************** self.block_list = pygame.sprite.Group( ) # Это список спрайтов. Каждый блок добавляется в этот список. self.all_sprites_list = pygame.sprite.Group( ) # # Это список каждого спрайта. Все блоки, а также блок игрока. self.bullet_list = pygame.sprite.Group() # тес массив спрайтов пули self.block_list_destruct = pygame.sprite.Group( ) # Массив разрушающихся блоков self.block_list_undestruct = pygame.sprite.Group( ) # Массив неразрушающихся блоков self.block_list.add(self.platforms) self.all_sprites_list.add(self.player, self.enemy) self.walls = [] for block in self.block_list: x, y = block.rect.topleft self.walls.append((x / 32, y / 32)) if block.destructibility: self.block_list_destruct.add(block) else: self.block_list_undestruct.add(block)
def parse_commands(byte_msg): if '/' not in str(byte_msg): message = b"[msg]=" + byte_msg out_message_queue.put(message) if '/quit' in str(byte_msg): print('Bye.') exit(1) def get_input(): while True: h, w = windows.text_window.getmaxyx() try: new_msg = windows.text_window.getstr(h - 2, w - w + 3, 90) parse_commands(new_msg) windows.refresh_text_window() except KeyboardInterrupt: print('Bye.') exit(1) if __name__ == "__main__": windows = Windows(curses.initscr()) # draw curses windows refresh_chat_window() # spawn a thread to keep chat window updated connect_socket('127.0.0.1', 5000) # spawn two thread connections, one sender, one receiver get_input() # loop waiting for user input
from ingredient import Ingredient from food import Food from foodlist import FoodList from ingredientlist import IngredientList from windows import Windows import pickle import easygui as ui import tkinter as tk food_list = FoodList() ingredient_list = IngredientList() # Step 1: Load the food list food_list.load_food( ) # In case there is no food list, an empty list gets loaded ingredient_list.load_ingredients() windows = Windows(food_list, ingredient_list) # Step 2: Starting the main loop and showing the options to the user win = windows.window win.mainloop()
def __init__(self): self.iphone = IPhone() self.samsung = Samsung() self.windows = Windows()