Sep-17-2020, 11:48 AM
Hi first time here, forgive me if this has been asked before, did a search and couldn't find it.
I am writing a script to send various commands from a touch screen to a flight simulator program. There are about 30 buttons that can be pressed on two pages and I thought making a Class for the buttons might help avoid writing dozens of if statements.
The Class would look something like this
Not even sure if a Class is appropriate here. Thanks
I am writing a script to send various commands from a touch screen to a flight simulator program. There are about 30 buttons that can be pressed on two pages and I thought making a Class for the buttons might help avoid writing dozens of if statements.
The Class would look something like this
class Sim_key: def __init__(self, name, key_mod, key_code, x_coord, y_coord, status): self.name = name self.key_code = key_code self.key_mod = key_mod self.key_code = key_code self.x_coord = x_coord self.y_coord = y_coord self.status = statusSo when the screen is touched I would have the x_coord and y_coord and use those (in a range like x(10,20) y(40,60)) to fire off the keyboard commands key_mod and key_code to the output routine.
Not even sure if a Class is appropriate here. Thanks