Oct-04-2017, 11:32 PM
Hi yall,
I'm having difficulties with the python timer and I would greatly appreciate for some advice.
I am working on keyboard control to disable the
When I try this:
I want to know how I could do that in python? can you please show me an example how I could do that using with my current code?
Thanks in advance
I'm having difficulties with the python timer and I would greatly appreciate for some advice.
I am working on keyboard control to disable the
MyPlayer.Control_EPG_ID
object in 5 seconds when I do not press on any buttons of the keyboard, but I have a bit of trouble with set up the timer. When I pressed on the down arrow buttons of the keyboard, it will set up the timer to 5 seconds but when I try to press on the right arrow button of the keyboard to change the text, it will not let me to change the text until to 5 seconds later.When I try this:
self.channel_pressed = False def onAction(self, action): if action.getId() in (ACTION_MOVE_UP, ACTION_MOVE_DOWN): self.channel_pressed = True if action.getId() == ACTION_MOVE_DOWN: if self.channel_pressed == True: if self.EPG_MINI_GUIDE == False: self.getControl(MyPlayer.Control_EPG_ID).setVisible(True) time.sleep(5000) self.getControl(MyPlayer.Control_EPG_ID).setVisible(False) elif action.getId() in (ACTION_MOVE_LEFT, ACTION_MOVE_RIGHT): next_program = self.getControl(MyPlayer.Control_EPG_Program_Next).getLabel() if action == ACTION_MOVE_RIGHT: if self.EPG_MINI_GUIDE == True: self.getControl(MyPlayer.Control_EPG_Program_Now).setLabel(next_program)When I removed the
time.sleep(5000
, I can be able to change the text without have any problem when I press on the right arrow button of the keyboard, but the problem is the MyPlayer.Control_EPG_ID
object will be disable in 1 second when I removed the time.sleep(5000)
. I want to use the time.sleep
to set up the timer to 5 seconds when I don't press on any buttons of the keyboard so I can start to disable the control for the MyPlayer.Control_EPG_ID
object in 5 seconds later. If I press any buttons of the keyboard, the timer should stop unless I don't press on any buttons of the keyboard.I want to know how I could do that in python? can you please show me an example how I could do that using with my current code?
Thanks in advance