How to use alert_buttons method in Airtest

Best Python code snippet using Airtest

interface_plan.py

Source:interface_plan.py Github

copy

Full Screen

...18 img_plus = img_plus.resize((130, 93), Image.ANTIALIAS)19 self.img_plus = ImageTk.PhotoImage(img_plus)20 self.alert_actions = tuple([self.alert_bt_0, self.alert_bt_1, self.alert_bt_2, self.alert_bt_3, self.alert_bt_4, self.alert_bt_5, self.alert_bt_6, self.alert_bt_7, self.quit])21 self.alert_buttons = []22 self.make_alert_buttons()23 self.pack(expand=True)24 def make_alert_buttons(self):25 btn_idx = 026 for row in range(1, 4):27 for col in range(3):28 action = self.alert_actions[btn_idx]29 img = self.img_off30 b_text = f" {btn_idx + 1} \n\nOFF"31 if row == 3 and col == 2:32 img = self.img_plus33 b_text = ""34 b = tk.Button(self, image = img, text=b_text, fg="#FFFFFF", bg="#000000", font=self.myFont, compound="center", borderwidth=0, relief=tk.FLAT, command=action)35 b.image = self.img_off36 b.grid(row=row, column=col, padx=10, pady = 10)37 self.alert_buttons.append(b)38 btn_idx += 1...

Full Screen

Full Screen

interface_test_gpio.py

Source:interface_test_gpio.py Github

copy

Full Screen

...10 super().__init__(self.master)11 self.myFont = font.Font(family='Helvetica', size=30, weight='bold')12 self.alert_actions = tuple([self.alert_bt_0, self.alert_bt_1, self.alert_bt_2, self.alert_bt_3, self.alert_bt_4, self.alert_bt_5, self.alert_bt_6, self.alert_bt_7, self.quit])13 self.alert_buttons = []14 self.make_alert_buttons()15 self.pack(fill=tk.BOTH, expand=True) # <-- because self is a tk.Frame16 def make_alert_buttons(self):17 btn_idx = 018 lbl_logo = tk.Label(self, text="ELO Light Control", font=('Helvetica', 20), height=2, width=15)19 lbl_logo.grid(row = 0, columnspan = 3, sticky = tk.NW)20 for row in range(1, 4):21 for col in range(3):22 action = self.alert_actions[btn_idx]23 b_text = f"{btn_idx + 1} \n OFF"24 if row == 3 and col == 2:25 b_text = "QUIT"26 b = tk.Button(self,27 text = b_text,28 font=self.myFont,29 command=action,30 height=2, width=9)...

Full Screen

Full Screen

interfac_test.py

Source:interfac_test.py Github

copy

Full Screen

...9 super().__init__(self.master)10 self.myFont = font.Font(family='Helvetica', size=30, weight='bold')11 self.alert_actions = tuple([self.alert_bt_0, self.alert_bt_1, self.alert_bt_2, self.alert_bt_3, self.alert_bt_4, self.alert_bt_5, self.alert_bt_6, self.alert_bt_7, self.quit])12 self.alert_buttons = []13 self.make_alert_buttons()14 self.pack(fill=tk.BOTH, expand=True) # <-- because self is a tk.Frame15 def make_alert_buttons(self):16 btn_idx = 017 lbl_logo = tk.Label(self, text="ELO Light Control", font=('Helvetica', 20), height=2, width=15)18 lbl_logo.grid(row = 0, columnspan = 3, sticky = tk.NW)19 for row in range(1, 4):20 for col in range(3):21 action = self.alert_actions[btn_idx]22 b_text = f"{btn_idx + 1} \n OFF"23 if row == 3 and col == 2:24 b_text = "QUIT"25 b = tk.Button(self,26 text = b_text,27 font=self.myFont,28 command=action,29 height=2, width=9)...

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 Airtest 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