How to use _refresh_screen method in ATX

Best Python code snippet using ATX

action_agent.py

Source:action_agent.py Github

copy

Full Screen

...8 def __init__(self):9 self.scr = ImageGrab.grab()10 self.enter_game()11 self.state_machine = StateMachine()12 def _refresh_screen(self):13 self.scr = ImageGrab.grab()14 def _click(self, point, delay=0.3):15 pyautogui.moveTo(point[0], point[1])16 time.sleep(delay)17 pyautogui.click(point[0], point[1])18 def activate_stripers(self, number):19 # Selection by mouse20 '''21 template = Image.open('img_templates/one_striper.jpg')22 self._refresh_screen()23 clicks = multi_detector(self.scr, template)24 clicks = clicks[:1] + [x for x in clicks if abs(x[0] - clicks[0][0]) > 4][:1]25 #print(clicks)26 for click in clicks:27 self._click(click)28 '''29 # selection by hotkeys30 hotkey = 'F{}'.format(number)31 pyautogui.keyDown(hotkey)32 pyautogui.keyUp(hotkey)33 time.sleep(0.2)34 self.aproach()35 def enter_game(self):36 template = Image.open('img_templates/ico_win_EVE.JPG')37 click = detector(self.scr, template)38 self._click(click)39 def warp_random_belt(self):40 self._refresh_screen()41 self.state_machine.get_objects(overview='Mining', n_obj=4)42 try:43 list_places = [x[2] for x in self.state_machine.objects if x[1][:4] == 'Auve']44 go_to = random.choice(list_places)45 self._click(go_to)46 self.warp_zero()47 except:48 pass49 def warp_zero(self):50 '''51 template = Image.open('img_templates/warp_zero.jpg')52 self._refresh_screen()53 clicks = multi_detector(self.scr, template)54 self._click(clicks[0])55 '''56 pyautogui.keyDown('s')57 pyautogui.keyUp('s')58 time.sleep(60)59 def dock(self):60 pyautogui.keyDown('d')61 pyautogui.keyUp('d')62 time.sleep(50)63 self.state_machine.change_state(1)64 def aproach(self):65 '''66 template = Image.open('img_templates/aproach.jpg')67 self._refresh_screen()68 clicks = multi_detector(self.scr, template)69 self._click(clicks[0])70 '''71 pyautogui.keyDown('q')72 pyautogui.keyUp('q')73 def target(self):74 '''75 template = Image.open('img_templates/target.jpg')76 self._refresh_screen()77 clicks = multi_detector(self.scr, template)78 self._click(clicks[0])79 '''80 pyautogui.keyDown('Ctrl')81 pyautogui.keyUp('Ctrl')82 def aproach_asteroid(self):83 self.state_machine.get_objects(overview='Mining', n_obj=10)84 try:85 go_to = [x[2] for x in self.state_machine.objects if x[1] == 'Asteroid'][0]86 self._click(go_to)87 time.sleep(1)88 self.target()89 time.sleep(0.3)90 self.aproach()91 except:92 pass93 def dock_station(self):94 self.state_machine.get_objects(overview='General')95 try:96 go_to = [x[2] for x in self.state_machine.objects][0]97 self._click(go_to)98 time.sleep(1)99 self.dock()100 time.sleep(40)101 except:102 pass103 def undock(self):104 # click undock105 pyautogui.moveTo(1797, 190)106 time.sleep(0.1)107 pyautogui.click(1797, 190)108 time.sleep(30)109 # click tactical view configuration110 pyautogui.moveTo(850, 967)111 time.sleep(0.1)112 pyautogui.click(850, 967)113 time.sleep(0.2)114 pyautogui.moveTo(924, 980)115 time.sleep(0.1)116 pyautogui.click(924, 980)117 def unload(self):118 # open inventory119 pyautogui.keyDown('Alt')120 pyautogui.keyDown('c')121 pyautogui.keyUp('c')122 pyautogui.keyUp('Alt')123 time.sleep(3)124 # click on ore hold125 pyautogui.moveTo(193, 320)126 time.sleep(0.2)127 pyautogui.click(193, 320)128 time.sleep(3)129 # click ore130 pyautogui.moveTo(337, 335)131 time.sleep(0.2)132 pyautogui.click(337, 335)133 time.sleep(3)134 # select all135 pyautogui.keyDown('Ctrl')136 pyautogui.keyDown('a')137 pyautogui.keyUp('a')138 pyautogui.keyUp('Ctrl')139 # drag to station140 pyautogui.mouseDown(337, 335)141 time.sleep(0.2)142 pyautogui.moveTo(187, 394)143 time.sleep(0.2)144 pyautogui.mouseUp(187, 394)145 time.sleep(2)146 # close inventory147 pyautogui.keyDown('Alt')148 pyautogui.keyDown('c')149 pyautogui.keyUp('c')150 pyautogui.keyUp('Alt')151 time.sleep(1)152 self.state_machine.cargo = 0153 def decision_tree(self):154 self._refresh_screen()155 if self.state_machine.test_docked(self.scr):156 if self.state_machine.cargo < 20:157 self.undock()158 else:159 self.unload()160 else:161 self.state_machine.check_cargo(self.scr)162 self.state_machine.read_location(self.scr)163 if self.state_machine.cargo > 95:164 self.dock_station()165 else:166 if 'Aste' not in self.state_machine.location:167 self.warp_random_belt()168 else:...

Full Screen

Full Screen

weather_station.py

Source:weather_station.py Github

copy

Full Screen

...18 self._historial = MultipleHistorial([1, 9, 90,])19 self.manual_update()20 def _change_mode(self, _):21 self._screen_mode = not self._screen_mode22 self._refresh_screen()23 def _read_values(self):24 # Read new values25 self.bme280.update()26 values = self.bme280.data27 self._historial.add(values)28 def _refresh_screen(self):29 if not self._screen_mode:30 self._setup_text()31 else:32 self._represent_values()33 def _setup_text(self):34 self._historial.current = self._historial.fastest35 self.oled.fill(0)36 self.oled.text("Temp: C", 16, 16)37 self.oled.text("Press: hPa", 0, 40)38 # Print new values39 values = (self._historial[0][-1],40 self._historial[1][-1])41 self._print_values(values, 1)42 self.oled.show()43 def manual_update(self):44 """45 Updates the values of temperature and pressure of the screen46 """47 self._read_values()48 self._refresh_screen()49 return50 def _print_values(self, values, color=1):51 self.oled.text("{:5.2f}".format(values[0]), 64, 16, color)52 self.oled.text("{:6.1f}".format(values[1]), 56, 40, color)53 def _represent_values(self):54 self._historial.cycle()55 self._create_axis()56 self._create_labels()57 self._plot_data()58 self.oled.show()59 def _create_axis(self):60 self.oled.fill(0)61 # create the axis62 self.oled.line(41, 0,...

Full Screen

Full Screen

controller_screen.py

Source:controller_screen.py Github

copy

Full Screen

...8_oled = ssd1306.SSD1306_I2C(128, 64, _i2c)9_oled.fill(0)10_current_text = []11_MAX_LINES = 712def _refresh_screen():13 _oled.fill(0)14 cnt = 015 for line in _current_text:16 cnt += 817 _oled.text(line, 0, cnt)18 _oled.show()19def print_new_line(line):20 """21 Adds a new line at the end of the screen.22 IF there isn't enough space, the first line23 gets deleted.24 """25 global _MAX_LINES, _current_text26 if len(_current_text) >= _MAX_LINES:27 _current_text = _current_text[1:]28 29 _current_text.append(line)30 _refresh_screen()31def clear_screen():32 """33 Clears the screen.34 """35 global _current_text36 _current_text = []37 _refresh_screen()38def clear_screen_print_line(line):39 """40 Clears the screen, and writes the line.41 """42 global _current_text43 _current_text = [line]...

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