How to use _init_display method in ATX

Best Python code snippet using ATX

epd2in13v2.py

Source:epd2in13v2.py Github

copy

Full Screen

...12class Epd2in13v2(Observer):13 def __init__(self, observable, mode):14 super().__init__(observable=observable)15 self.epd = epd2in13_V2.EPD()16 self.screen_image = self._init_display(self.epd)17 @staticmethod18 def _init_display(epd):19 epd.init(epd.FULL_UPDATE)20 epd.Clear(0xFF)21 screen_image = Image.new('1', (SCREEN_WIDTH, SCREEN_HEIGHT), 255)22 epd.displayPartBaseImage(epd.getbuffer(screen_image))23 epd.init(epd.PART_UPDATE)24 return screen_image25 def form_image(self, prices, screen_draw):26 screen_draw.rectangle((0, 0, SCREEN_WIDTH, SCREEN_HEIGHT), fill="#ffffff")27 Plot.line(prices, size=(SCREEN_WIDTH - 45, 93), position=(45, 0), draw=screen_draw)28 Plot.y_axis_labels(prices, FONT_SMALL, (0, -4), (0, 81), draw=screen_draw)29 screen_draw.line([(10, 98), (240, 98)])30 screen_draw.line([(39, 4), (39, 94)])31 Plot.caption(prices[len(prices) - 1], 98, SCREEN_WIDTH, FONT_LARGE, screen_draw)32 def update(self, data):...

Full Screen

Full Screen

oled.py

Source:oled.py Github

copy

Full Screen

...4from PIL import ImageFont5FONT_NAME = "/home/pi/programming/serial/VCR.ttf"6class OledDisplay:7 def __init__(self):8 self._display = self._init_display()9 self._font_28 = ImageFont.truetype(FONT_NAME, 28)10 self._font_16 = ImageFont.truetype(FONT_NAME, 16)11 self._font_12 = ImageFont.truetype(FONT_NAME, 12)12 @staticmethod13 def _init_display():14 display = Adafruit_SSD1306.SSD1306_128_64(rst=24)15 display.begin()16 display.clear()17 display.display()18 return display19 def update(self, time, co2, temp, humidity):20 width = self._display.width21 height = self._display.height22 image = Image.new('1', (width, height))23 draw = ImageDraw.Draw(image)24 draw.text((0, 40), time, font=self._font_28, fill=255)25 co2_text = "%04d" % co226 draw.text((65, -4), co2_text, font=self._font_28, fill=255)27 draw.text((44, 0), "co2", font=self._font_12, fill=255)...

Full Screen

Full Screen

grid_world_game.py

Source:grid_world_game.py Github

copy

Full Screen

...5class GridWorld():6 def __init__(self, w=10,h=10):7 self.w = w*BLOCK_SIZE8 self.h = h*BLOCK_SIZE9 self._init_display(self.w,self.h)10 11 def loop_play_step(self):12 game_over = False13 for event in pygame.event.get():14 if event.type == pygame.QUIT:15 pygame.quit()16 quit()17 self._update_ui()18 self.clock.tick(30)19 return game_over20 21 def _update_ui(self):22 text = self.font.render("press Q for bellman expectation, W for policy improvement, E Policy Iteration", True, WHITE)23 self.display.blit(text, [0, 0])24 pygame.display.flip()25 def _init_display(self,w,h):26 pygame.init()27 self.display = pygame.display.set_mode((w,h))28 self.clock = pygame.time.Clock()29 #print(pygame.font.get_fonts())30 #print(pygame.font.match_font('arial'))31 self.font = pygame.font.Font(pygame.font.match_font('arial'), 20)32 33if __name__ == '__main__':34 my_grid_world = GridWorld(20,20)35 game_over = False36 while not game_over:...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run ATX automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful