def play(self, n_turns, delay): for turn in range(0, n_turns): print("turn: " + str(turn) + " ", end="") Drawer.draw(self.life_grid) if turn < (n_turns - 1): time.sleep(delay) self.life_grid = self.life_algo.play(self.life_grid) exit(0)
def main(): # tk = Track('tracks/simple_straight/simple_straight.tk') # rl = Racingline('tracks/simple_straight/rl01.rl') # tk = Track('tracks/simple_90/simple_90.tk') # rl = Racingline('tracks/simple_90/rl01.rl') tk = Track('tracks/simple_90_narrow/simple_90_narrow.tk') rl = Racingline('tracks/simple_90_narrow/rl01.rl') # d = Drawer(tk, [rl]) # d.draw() rls = [rl] evolution_generation_cnt = 1200 for generation in range(evolution_generation_cnt): rls = Evolutioner.evolution(rls) results = [] for rl in rls: res = RacingResult(tk, rl) res.race() if not res.finished: continue else: results.append(res) results.sort(key=lambda x: x.time) j = 1 while True: if j >= len(results): break elif results[j] == results[j - 1]: del results[j] else: j += 1 if generation < 500: max_len = 1 elif generation < 800: max_len = 2 elif generation < 1000: max_len = 5 elif generation < 1100: max_len = 10 elif generation < 1150: max_len = 20 else: max_len = 50 if len(results) > max_len: results = results[:max_len] rls.clear() for res in results: rls.append(res.racingline) print('generation: %4d, best time: %7.3f' % (generation, results[0].time)) d = Drawer(tk, rls[:1]) d.draw()
class Dotplot(object): def __init__(self, sequences, plotter_args=None, drawer_args=None): self.sequences = [ Sequence.from_fasta_file(sequences.file1), Sequence.from_fasta_file(sequences.file2) ] self.plotter = Plotter(plotter_args) self.drawer = Drawer(drawer_args) def make_plot(self): self.plot = self.plotter.plot(self.sequences) def draw(self, plot=None): if not plot: plot = self.plot self.drawer.draw(plot)
class Gui(Holder): """ core of the treegui system handles most of the events prods other ui system such as layout and drawing into doing stuff """ def __init__(self,keys=None,theme=None): """ initilizes the gui """ import __builtin__ __builtin__.gui = self self.node = aspect2d self.id = "root" self.dragWidget = None self.dragPos = Vec2(0,0) self.dragFun = None self.dragSnap = False self.lastDragMoue = Vec2(0,0) self.hoveringOver = None self.parent = False self.children = [] self.idToFrame = {} self.pos = Vec2(0,0) self.windowsize = 800,600 self.size = Vec2(*self.windowsize) self.mouse = Vec2(0,0) self.node.setBin("fixed",2) self.node.setDepthWrite(False) self.node.setDepthTest(False) if not keys: self.keys = Keys() else: self.keys = keys if not theme: self.theme = Theme() else: self.theme = theme self.layout = Layout() self.drawer = Drawer() task(self._doMouse,-10) self._reSize() task(self._doDrag,10) task(self._reSize,20) task(self._layout,30) task(self._draw,40) def byId(self,name): if name in self.idToFrame: return self.idToFrame[name] def _layout(self): """ prods layout to do its thing """ # compute children's real positions self.layout.do() def _draw(self): """ prods drawer to do its thing """ self.drawer.draw(self.children) def _reSize(self): """ resize the window via panda3d internal events""" self.windowsize = base.win.getXSize(),base.win.getYSize() self.size = Vec2(*self.windowsize) self.aspect = float(self.windowsize[0]) / float(self.windowsize[1]) self.node.setScale(2./base.win.getXSize(), 1, -2./base.win.getYSize()) self.node.setPos(-1, 0, 1) self.node.reparentTo(render2d) self._x = 0 self._y = 0 self._width = self.size[0] self._height = self.size[1] def baseMouseEvent(self,key): """ acts like user clicked mouse with key """ md = base.win.getPointer( 0 ) self.mouseX = md.getX() self.mouseY = md.getY() m = self.mouseEvent(key,self.mouseX,self.mouseY) return m def _doMouse(self): """ treegui's low level mouse interface """ used = self.baseMouseEvent("hover") if not used: if gui.hoveringOver and gui.hoveringOver.onOut: gui.hoveringOver.onOut() gui.hoveringOver = None def drag(self,widget,dragSnap=False): """ drags a widget """ if not self.dragWidget : self.dragWidget = widget self.dragSnap = dragSnap self.dragPosX = widget._x-gui.mouseX self.dragPosY = widget._y-gui.mouseY widget.parent.toFront(widget) def _doDrag(self): """ task that does dragging at low level """ if self.dragWidget: self.dragWidget.x = self.dragPosX+gui.mouseX self.dragWidget.y = self.dragPosY+gui.mouseY if self.dragWidget.onDrag: self.dragWidget.onDrag() if self.dragSnap: def close(a,b): return abs(a-b) < 15 if close(self.dragWidget.x,0): self.dragWidget.x = "left" elif close( self.dragWidget.x + self.dragWidget._width, self.dragWidget.parent._width): self.dragWidget.x = "right" if close(self.dragWidget.y,0): self.dragWidget.y = "top" elif close( self.dragWidget.y + self.dragWidget._height, self.dragWidget.parent._height): self.dragWidget.y = "bottom" def focusOn(self,focus): if self.keys.focus: self.keys.focus.onUnFocus() focus.onFocus() self.keys.focus = focus return focus def focusNext(self,focus): i = focus.parent.children.index(focus) i -= 1 if i == -1 : i = len(focus.parent.children) - 1 newFocus = focus.parent.children[i] while not newFocus.control and newFocus != focus: i = newFocus.parent.children.index(newFocus) i -= 1 if i == -1 : i = len(focus.parent.children) - 1 newFocus = focus.parent.children[i] print "new",newFocus return self.focusOn(newFocus) def toggle(self): if self.node.isHidden(): self.node.show() else: self.node.hide()
class Player: def __init__(self): self.game_size = 50 self.ticks_per_second = 120 screen_size_x = 800 screen_size_y = 800 self.land = Land(self.game_size) self.drawer = Drawer(screen_size_x, screen_size_y, self.land) self.controller = Controller(self.land, self.drawer) def random_setup(self): for x in range(self.game_size): for y in range(self.game_size): num = random() if num < 0.01: # 1% bunnies thing = Bunny(x, y) self.controller.put(thing) elif num < 0.013: # 0.3% wolves thing = Wolf(x, y) self.controller.put(thing) elif num < 0.315: # 30% bushes thing = Bush(x, y) self.controller.put(thing) else: # 60% empty space pass # and 100% reason to remember the name <---- joke comment, disregard def small_setup(self): self.controller.put(Wolf(20, 20)) self.controller.put(Bunny(19, 20)) self.controller.put(Bunny(22, 20)) self.controller.put(Bunny(21, 19)) self.controller.put(Bunny(21, 23)) self.controller.put(Bunny(21, 22)) def play(self): # Loop until the user clicks the close button. done = False pause = False clock = pygame.time.Clock() self.drawer.draw(self.controller.land) # draw the entire canvas tick_count = 0 start_time = time() while not done: for event in pygame.event.get(): # User did something if event.type == pygame.QUIT: # If user clicked close done = True # Flag that we are done so we exit this loop elif event.type == pygame.MOUSEBUTTONUP: pause = not pause tick_count += 1 #if tick_count % self.ticks_per_second == 0: #end_time = time() #print(end_time - start_time) #start_time = end_time if not pause: self.controller.tick() # controller.print_tmi() # print(tick_count) # print() # This limits the while loop to a max amount of ticks per second. clock.tick(self.ticks_per_second) # Be IDLE friendly pygame.quit()
from track import Track from drawer import Drawer from racingline import Racingline from evolutioner import Evolutioner # d = Drawer(Track('tracks/simple_straight/simple_straight.tk'), [Racingline('tracks/simple_straight/rl01.rl')]) # d.draw() tk = Track('tracks/simple_straight/simple_straight.tk') rl = Racingline('tracks/simple_straight/rl01.rl') # print(tk.race(rl)) # # d = Drawer(tk, [rl]) # d.draw() rls = Evolutioner.evolution(rl) for rl in rls: print(rl) print(tk.race(rl)) print(rls) d = Drawer(tk, rls) d.draw()
class Game(): def __init__(self, size, bombs_proportion, no_cursor=False, no_drawing=False): random.seed(time.time()) self.__no_cursor = no_cursor self.__no_drawing = no_drawing self.__size = size if self.__size < MIN_SIZE: self.__size = MIN_SIZE if self.__size > MAX_SIZE: self.__size = MAX_SIZE if bombs_proportion < MIN_BOMBS: bombs_proportion = MIN_BOMBS if bombs_proportion > MAX_BOMBS: bombs_proportion = MAX_BOMBS self.__bombs_count = int(bombs_proportion * self.__size**2) self.__hidden_count = self.__size**2 - self.__bombs_count self.__grid = [[0 for _ in range(self.__size)] for _ in range(self.__size)] self.__grid_mask = [[0 for _ in range(self.__size)] for _ in range(self.__size)] self.__bombs_placed = False self.__cursor = {'x': 0, 'y': 0} self.__status = 'in_game' self.__drawer = Drawer(self.__size, self.__bombs_count) self.__drawer.draw(self.__grid, self.__grid_mask, self.__cursor) def play_as_player(self): while self.__status == 'in_game': user_char = getch.getch() self.__action(user_char) def __action(self, user_char): if user_char == 'h': self.go_left() if user_char == 'j': self.go_down() if user_char == 'k': self.go_up() if user_char == 'l': self.go_right() if user_char == 'H': self.go_max_left() if user_char == 'J': self.go_max_down() if user_char == 'K': self.go_max_up() if user_char == 'L': self.go_max_right() if user_char == 'f': self.update_flag() if user_char == ' ': self.reveal_cell() if user_char == 'a': self.reveal_around() def __draw(self): if self.__status == 'in_game': if not self.__no_drawing: self.__drawer.draw(self.__grid, self.__grid_mask, self.__cursor) else: self.__drawer.display_end_screen(self.__status, self.__grid, self.__grid_mask, self.__cursor) def reveal_around(self): if self.__status == 'in_game': if not self.__bombs_placed: self.__place_bombs() self.__reveal_around() self.__draw() def reveal_cell(self): if self.__status == 'in_game': if not self.__bombs_placed: self.__place_bombs() self.__reveal_cell(self.__cursor['x'], self.__cursor['y']) self.__draw() def go_max_right(self): if self.__status == 'in_game': self.__cursor['x'] = self.__size - 1 if not self.__no_cursor: self.__draw() def go_max_up(self): if self.__status == 'in_game': self.__cursor['y'] = 0 if not self.__no_cursor: self.__draw() def go_max_left(self): if self.__status == 'in_game': self.__cursor['x'] = 0 if not self.__no_cursor: self.__draw() def go_max_down(self): if self.__status == 'in_game': self.__cursor['y'] = self.__size - 1 if not self.__no_cursor: self.__draw() def go_right(self): if self.__status == 'in_game' and self.__cursor['x'] < self.__size - 1: self.__cursor['x'] += 1 if not self.__no_cursor: self.__draw() def go_up(self): if self.__status == 'in_game' and self.__cursor['y'] > 0: self.__cursor['y'] -= 1 if not self.__no_cursor: self.__draw() def go_left(self): if self.__status == 'in_game' and self.__cursor['x'] > 0: self.__cursor['x'] -= 1 if not self.__no_cursor: self.__draw() def go_down(self): if self.__status == 'in_game' and self.__cursor['y'] < self.__size - 1: self.__cursor['y'] += 1 if not self.__no_cursor: self.__draw() def update_flag(self): if self.__status == 'in_game': x = self.__cursor['x'] y = self.__cursor['y'] if self.__grid_mask[x][y] == 2: self.__grid_mask[x][y] = 0 elif self.__grid_mask[x][y] == 0: self.__grid_mask[x][y] = 2 self.__draw() def __reveal_around(self): x = self.__cursor['x'] y = self.__cursor['y'] if x > 0 and y > 0 and self.__status == 'in_game': self.__reveal_cell(x - 1, y - 1) if x > 0 and self.__status == 'in_game': self.__reveal_cell(x - 1, y) if x > 0 and y < self.__size - 1 and self.__status == 'in_game': self.__reveal_cell(x - 1, y + 1) if y > 0 and self.__status == 'in_game': self.__reveal_cell(x, y - 1) if y < self.__size - 1 and self.__status == 'in_game': self.__reveal_cell(x, y + 1) if x < self.__size - 1 and y > 0 and self.__status == 'in_game': self.__reveal_cell(x + 1, y - 1) if x < self.__size - 1 and self.__status == 'in_game': self.__reveal_cell(x + 1, y) if x < self.__size - 1 and y < self.__size - 1 and self.__status == 'in_game': self.__reveal_cell(x + 1, y + 1) def __reveal_cell(self, x, y): if self.__grid_mask[x][y] == 0: self.__hidden_count -= 1 self.__grid_mask[x][y] = 1 if self.__grid[x][y] == -1: self.__status = 'lost' elif self.__hidden_count == 0: self.__status = 'won' else: if self.__grid[x][y] == 0: self.__flood_empty(x, y) def __flood_empty(self, x, y): queue = [(x, y)] while queue: cell = queue.pop(0) if cell[0] > 0: new_cell = self.__flood(cell[0] - 1, cell[1]) if new_cell != None: queue.append(new_cell) if cell[1] > 0: new_cell = self.__flood(cell[0], cell[1] - 1) if new_cell != None: queue.append(new_cell) if cell[0] < self.__size - 1: new_cell = self.__flood(cell[0] + 1, cell[1]) if new_cell != None: queue.append(new_cell) if cell[1] < self.__size - 1: new_cell = self.__flood(cell[0], cell[1] + 1) if new_cell != None: queue.append(new_cell) if cell[0] > 0 and cell[1] > 0: new_cell = self.__flood(cell[0] - 1, cell[1] - 1) if new_cell != None: queue.append(new_cell) if cell[0] > 0 and cell[1] < self.__size - 1: new_cell = self.__flood(cell[0] - 1, cell[1] + 1) if new_cell != None: queue.append(new_cell) if cell[0] < self.__size - 1 and cell[1] > 0: new_cell = self.__flood(cell[0] + 1, cell[1] - 1) if new_cell != None: queue.append(new_cell) if cell[0] < self.__size - 1 and cell[1] < self.__size - 1: new_cell = self.__flood(cell[0] + 1, cell[1] + 1) if new_cell != None: queue.append(new_cell) if self.__hidden_count == 0: self.__status = 'won' def __flood(self, x, y): cell = None if self.__grid_mask[x][y] != 1: self.__hidden_count -= 1 self.__grid_mask[x][y] = 1 if self.__grid[x][y] == 0: cell = (x, y) return cell def __place_bombs(self): for _ in range(self.__bombs_count): bomb_placed = False while not bomb_placed: x = random.randint(0, self.__size - 1) y = random.randint(0, self.__size - 1) if x != self.__cursor['x'] and y != self.__cursor['y'] and self.__grid[x][y] != -1: bomb_placed = True self.__grid[x][y] = -1 for y in range(self.__size): for x in range(self.__size): if self.__grid[x][y] != -1: self.__grid[x][y] = self.__count_bombs_in_neighbourhood(x, y) self.__bombs_placed = True def __count_bombs_in_neighbourhood(self, x, y): count = 0 if x > 0 and y > 0 and self.__grid[x - 1][y - 1] == -1: count += 1 if x > 0 and self.__grid[x - 1][y] == -1: count += 1 if x > 0 and y < self.__size - 1 and self.__grid[x - 1][y + 1] == -1: count += 1 if y > 0 and self.__grid[x][y - 1] == -1: count += 1 if y < self.__size - 1 and self.__grid[x][y + 1] == -1: count += 1 if x < self.__size - 1 and y > 0 and self.__grid[x + 1][y - 1] == -1: count += 1 if x < self.__size - 1 and self.__grid[x + 1][y] == -1: count += 1 if x < self.__size - 1 and y < self.__size - 1 and self.__grid[x + 1][y + 1] == -1: count += 1 return count def get_cursor(self): return deepcopy(self.__cursor) def get_status(self): return self.__status def get_size(self): return self.__size def get_bombs_count(self): return self.__bombs_count def get_grid(self): grid = deepcopy(self.__grid) for x in range(self.__size): for y in range(self.__size): if self.__grid_mask[x][y] == 0: grid[x][y] = None elif self.__grid_mask[x][y] == 2: grid[x][y] = -2 return grid
def displayMessage(code): if (code == 1): print('Selected position was cleared') elif (code == 2): print('Position does not exists') elif (code == 3): print('You stepped on a bomb, game over') elif (code == 4): print('Position already clear') elif (code == 6): print('You won') if __name__ == "__main__": uRows = int(input('Type in the number of rows for this game:\n')) uCols = int(input('Type in the number of columns for this game:\n')) nBombs = int(input('Type in the number of bombs for this game:\n')) mf = MineField(uRows, uCols, nBombs) dw = Drawer(mf.board) while (not mf.isOver): dw.draw(mf.positionsCleared) x = int(input('Type in a value for the X axis: ')) y = int(input('Type in a value for the Y axis: ')) code = mf.selectPos(x, y) displayMessage(code) if (code in (3, 6)): mf.isOver = True dw.draw(mf.positionsCleared)
class Main: def __init__(self, width, height, caption): self.width = width self.height = height self.caption = caption self.drawer = Drawer(self) self.logic = Logic() def init(self): pygame.init() pygame.display.set_caption(self.caption) self.screen = pygame.display.set_mode((self.width, self.height)) self.drawer.init() # start game with clear surface self.drawer.clear() self.draw_info() pygame.display.flip() # spwn number in one second after game start pygame.time.set_timer(SPAWN, 1000) def quit(self): pygame.quit() def loop(self): running = True while running: event = pygame.event.wait() if event.type == pygame.QUIT: running = False elif event.type == SPAWN: self.spawn() elif event.type == pygame.KEYDOWN: if event.key == pygame.K_ESCAPE: running = False else: self.submit(event.key) def spawn(self): pygame.time.set_timer(SPAWN, 0) self.logic.start_test() transform = self.logic.current_transform self.drawer.draw(transform) self.draw_info() pygame.display.flip() def submit(self, key): if key in (pygame.K_SPACE, pygame.K_r, pygame.K_f): # neither rotated nor flipped if key == pygame.K_SPACE: self.logic.submit_result(False, False) elif key == pygame.K_r: self.logic.submit_result(True, False) else: # key == pygame.K_f self.logic.submit_result(False, True) # make number disappear self.drawer.clear() self.draw_info() pygame.display.flip() # spawn another test in one second pygame.time.set_timer(SPAWN, 1000) def draw_info(self): text = "Tests Completed: %d\nTests Failed: %d\nAverage Time: %f sec" % (self.logic.tests_completed, self.logic.tests_failed, (float(self.logic.average_time)/1000.0)) self.drawer.render_text(text, False) self.drawer.render_text("Press R if rotated\nPress F if flipped\nPress SPACE if neither apply", True)
def main(_): if FLAGS.interval > 3: sys.exit(' [!] {} is too big detector interval...'.format( FLAGS.interval)) os.environ['CUDA_VISIBLE_DEVICES'] = FLAGS.gpu_index img_shape = (720, 1280, 3) model = Model(FLAGS) # Initialize detection network tracker = Tracker(img_shape, min_hits=3, num_classes=8, interval=FLAGS.interval) # Initialize tracker drawer = Drawer(FLAGS, img_shape) # Inidialize drawer class recoder = None if FLAGS.is_record: recoder = RecordVideo(FLAGS, img_shape) window_name0 = 'Detection-by-Tracking' window_name1 = 'Detection Only' cv2.namedWindow(window_name0) cv2.namedWindow(window_name1) cv2.moveWindow(window_name0, 630, 0) cv2.moveWindow(window_name1, 1920, 0) cap = cv2.VideoCapture(FLAGS.data) frameID = 0 moving_tra, moving_det = 0., 0. while cap.isOpened(): ret, raw_frame = cap.read() if ret is False: print(' [!] Can not read vidoe frame!') break # print('frameID: {}'.format(frameID)) tic = time.time() dets_arr, labels_arr, is_dect = None, None, None if np.mod(frameID, FLAGS.interval) == 0: dets_arr, labels_arr = model.test(raw_frame) is_dect = True elif np.mod(frameID, FLAGS.interval) != 0: dets_arr, labels_arr = np.array([]), np.array([]) is_dect = False pt_det = (time.time() - tic) # unit is sec. tracker_arr = tracker.update(dets_arr, labels_arr, is_dect=is_dect) # tracker pt_tra = (time.time() - tic) if frameID != 0: moving_tra = (frameID / (frameID + 1) * moving_tra) + (1. / (frameID + 1) * pt_tra) moving_det = (frameID / (frameID + 1) * moving_det) + (1. / (frameID + 1) * pt_det) show_frame = drawer.draw(raw_frame, tracker_arr, labels_arr, (1. / (moving_tra + 1e-8)), is_tracker=True) det_frame = drawer.draw(raw_frame, dets_arr, labels_arr, (1. / (moving_det + 1e-8)), is_tracker=False) cv2.imshow(window_name0, show_frame) cv2.imshow(window_name1, det_frame) if cv2.waitKey(FLAGS.delay) & 0xFF == 27: sys.exit(' [*] Esc clicked!') frameID += 1 if FLAGS.is_record: recoder.record(show_frame, det_frame) if FLAGS.is_record: recoder.turn_off()
def main(): global selected_figure_index sdl2.ext.init() window = sdl2.ext.Window("Filled polygon", size=(640, 480)) window.show() window_surface = window.get_surface() pixels = sdl2.ext.PixelView(window_surface) figures = [ Figure([ Point(150, 100), Point(250, 100), Point(250, 210), Point(150, 210) ], sdl2.ext.Color(0, 255, 0, 255), sdl2.ext.Color(255, 255, 255, 255), z_order=1), Figure([ Point(500, 60), Point(300, 100), Point(550, 100) ], sdl2.ext.Color(0, 0, 255, 255), sdl2.ext.Color(255, 255, 255, 255), z_order=2) ] figures.sort(key=lambda f: f.z_order) cutting_off_field = SquareCuttingOffField(50, 590, 430, 50, sdl2.ext.Color(255, 0, 0, 255)) drawer = Drawer(pixels, cutting_off_field, figures) running = True old_x = ctypes.c_int32(0) old_y = ctypes.c_int32(0) last_rotate_time = 0 is_changed = True while running: events = sdl2.ext.get_events() for event in events: if event.type == sdl2.SDL_QUIT: running = False break if event.type == sdl2.SDL_MOUSEBUTTONDOWN: selected_figure_index = None SDL_GetMouseState(ctypes.byref(old_x), ctypes.byref(old_y)) for i in range(len(figures)): if figures[i].is_point_inside(Point(old_x.value, old_y.value)): selected_figure_index = i break if event.type == sdl2.SDL_MOUSEBUTTONUP: selected_figure_index = None if event.type == sdl2.SDL_MOUSEMOTION: if selected_figure_index is not None: x = ctypes.c_int32(0) y = ctypes.c_int32(0) SDL_GetMouseState(ctypes.byref(x), ctypes.byref(y)) dx = x.value - old_x.value dy = y.value - old_y.value old_x = x old_y = y figures[selected_figure_index].move(dx, dy) is_changed = True if event.type == sdl2.SDL_MOUSEWHEEL: x = ctypes.c_int32(0) y = ctypes.c_int32(0) SDL_GetMouseState(ctypes.byref(x), ctypes.byref(y)) active_figure = None for figure in figures: if figure.is_point_inside(Point(old_x.value, old_y.value)): active_figure = figure break if active_figure: active_figure.rotate(event.wheel.y) is_changed = True if is_changed: clear(window_surface) drawer.draw() window.refresh() is_changed = False sdl2.ext.quit() return 0
from drawer import Drawer from system import System rules = {'X': 'F[-X][X]F[-X]+FX', 'F': 'pFF'} s = System('X', rules) d = Drawer(draw_speed=0, init_angle=0, init_size=7, fwd_amt=5, turn_amt=30, inc_amt=0.1) d.draw(s.get_str(6)) try: input('any key to exit') except: pass
val = key.uni if key.valid else "" # If R pressed clear the sudoku board if event.key == pygame.K_ESCAPE: pygame.quit() # grid = puzzle.empty_matrix # If D is pressed reset the board to default if list(grid.flatten()) == puzzle.solution: flag2 = 1 if flag2 == 1: rs = 1 flag2 = 0 if val: drawer.draw_val(val) grid[int(drawer.x) - 10][int(drawer.y)] = val.upper() val = 0 if rs == 1: drawer.draw_result() drawer.draw(puzzle.letters_matrix.shape[0], grid) if flag1 == 1: drawer.draw_box() drawer.draw_expressions(puzzle.rows_expressions, puzzle.cols_expressions) drawer.draw_instruction() # Update window pygame.display.update() # Quit pygame window pygame.quit()
d = Drawer() savefig_path = None if int(ns.saveplots): # Сохранять графики if not os.path.exists(Settings.Plots.PlotRoot): os.makedirs(Settings.Plots.PlotRoot) if not os.path.exists(Settings.Plots.TbPlotDir): os.makedirs(Settings.Plots.TbPlotDir) savefig_path = os.path.join(Settings.Plots.TbPlotDir, lbl + '.tb' + '.png') if not int(ns.noplots): d.draw(m.DATA, # title=u'Brightness temperatures', xlabel=u'время (чч:мм)', ylabel=u'Яркостная температура, K', labels=parameter.plot.labels('ru').basic_plus, colors=parameter.plot.colors.basic_plus, linestyles=parameter.plot.linestyles.basic_plus, linewidth=1.35, timeformat='hm', savefig_path=savefig_path) if int(ns.tbreport): if not os.path.exists(Settings.Reports.ReportRoot): os.makedirs(Settings.Reports.ReportRoot) if not os.path.exists(Settings.Reports.TbReportDir): os.makedirs(Settings.Reports.TbReportDir) report_path = os.path.join(Settings.Reports.TbReportDir, lbl + '.tb' + '.txt') Reports.makeTable(m.DATA, report_path) if not int(ns.nosf): SFData = structural_functions(m.DATA)