Reputation: 133
I am working on the code to input the numbers in the string self.EPG_DIGIT_NUMBER
when I'm pressing on the keyboard number buttons. I would like to add the empty string like this in each time when I press on the keyboard number buttons.
DIGIT_BUTTONS = range(58, 68)
if action.getId() in DIGIT_BUTTONS:
EPG_DIGIT_NUMBER = len(self.EPG_DIGIT)
if EPG_DIGIT_NUMBER <= 2:
self.EPG_DIGIT_NUMBER += str(action.getId() - 58)
self.EPG_DIGIT += 1
self.getControl(413).setLabel('[B]' + self.EPG_DIGIT_NUMBER + '[/B]')
When I press on the keyboard numbers 1,0,3, it will show 103
in the string. What I want to achieve is when I press on the keyboard number buttons 1,0,3, I want to make the string to show something is like: 1 0 3
. How I can do that?
Upvotes: 0
Views: 115
Reputation: 6748
Change self.EPG_DIGIT_NUMBER += str(action.getId() - 58)
to self.EPG_DIGIT_NUMBER += (str(action.getId() - 58)+' ')
so that a space gets appended to the end of the number after each time a number is pressed.
Upvotes: 1