Aug-31-2021, 06:22 PM
(Aug-31-2021, 05:43 PM)deanhystad Wrote: Instead of a list I would use a dictionary that maps button labels to commands.
commands = { 'TV Standby':'standby', ... 'Air Conditioning On': 'ac on', 'Air Conditioning Off': 'ac off' } btn_titles = list(command.keys())Then use the dictionary to get the command.
def button_clicked(self, idx, title): command = commands[title] # send command
Hi, thank you for your comment. Can you please show me how to attach these parts in to the code ? And I should use import bluetooth right ?