Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
pythonista UI
-
@shinya.ta if the VoiceOver sound comes, why do you need a second sound?
Anyway, you could add some delay before the speech line with
time.sleep(0.5)
It needs also to import time at begin of your script.
The number is the delay in seconds, perhaps you have to test different values -
Thank you very much.
We pronounce Voiceover sounds at the same time when we tap the button.
Therefore, the voice sounded like two people were talking together. -
-
Is the following code wrong?
is_speaking ()
"time. sleep (0.5)" slowed the time to open Windows and didn't delay reading.
-
@shinya.ta yes
from time import sleep . . . . sleep(0.5)
-
@shinya.ta I think is_sleeping() tests if speech is active, not VoiceOver.
You're right for the delay -
@cvp
.
.
.
sleep(0.5)↑ Is the place to insert the cord bad?
-
@shinya.ta You could try to inverse cursor/sleep/speech
tvo = ObjCInstance(tv) p1 = tvo.positionFromPosition_offset_(tvo.beginningOfDocument(), i) p2 = p1 tvo.selectedTextRange = tvo.textRangeFromPosition_toPosition_(p1,p2) sleep(0.5) #speech.say(c,'en-US') speech.say(c,'ja-JP')
-
It was successful.
Even if I use VoiceOver, they read aloud properly.
Thank you very much.
This completes.After all, you're genius.
I'm full of gratitude.Thank you very much for your help.
-
@shinya.ta You are too kind. Really, I'm not a genius at all.
Happy to have helped you and your wife with this marvelous app. -
Dear.@cvp
I noticed it when I was adjusting the application.
I want to delete the back of the cursor like the delete button on the iPhone.
In this situation, you can't delete letters at the place where the cursor is moved.
Where should I change the code?
b_del = ui.Button()
b_del.frame = (10,250,100,32)
b_del.title = 'del'
b_del.background_color = 'white'
b_del.border_width = 1
def b_del_action(sender):
tv = sender.superview['TextView']
i = tv.selected_range[0]
if i < len(tv.text):
tv.text = tv.text[:i] + tv.text[i+1:]
#tv.selected_range = (i,i) # refused if i = len(tv.text)
tvo = ObjCInstance(tv)
p1 = tvo.positionFromPosition_offset_(tvo.beginningOfDocument(), i)
p2 = p1
tvo.selectedTextRange = tvo.textRangeFromPosition_toPosition_(p1,p2)
say_char(tv)
b_del.action = b_del_action
v.add_subview(b_del) -
@shinya.ta As I don't know if you want to have two buttons, I let the code for both actions.
See the explanations in commentsb_del = ui.Button() b_del.frame = (10,250,100,32) b_del.title = 'del' b_del.background_color = 'white' b_del.border_width = 1 def b_del_action(sender): tv = sender.superview['TextView'] i = tv.selected_range[0] #if i < len(tv.text): # if delete at cursor if i > 0: # if delete at left of cursor #tv.text = tv.text[:i] + tv.text[i+1:] # if delete at cursor tv.text = tv.text[:i-1] + tv.text[i:] # if delete at left of cursor i = i - 1 # if delete at left of cursor #tv.selected_range = (i,i) # refused if i = len(tv.text) tvo = ObjCInstance(tv) p1 = tvo.positionFromPosition_offset_(tvo.beginningOfDocument(), i) p2 = p1 tvo.selectedTextRange = tvo.textRangeFromPosition_toPosition_(p1,p2) say_char(tv) b_del.action = b_del_action v.add_subview(b_del)```
-
Thank you very much.
I am not good at English, but I understand the meaning of comments.
I tried to solve it by myself, but I was in trouble because there was only an error message.
I will finish work after three hours, so I will try it immediately.
-
It was successful, thank you.
I have another question. If I use the copy button, I copy the code of this application.
Why can't I make a copy of the textbook?
-
@shinya.ta It's because your line b_copy.action = b_copy_action is indented in the def...
def b_copy_action(sender): tv = sender.superview['TextView'] clipboard.set(tv.text) b_copy.action = b_copy_action v.add_subview(b_copy)
Must become
def b_copy_action(sender): tv = sender.superview['TextView'] clipboard.set(tv.text) b_copy.action = b_copy_action v.add_subview(b_copy)
-
Thank you very much.
This really ends.
I'm full of gratitude.
My wife was very satisfied.Oh God, thank you very much.
-
-
Dear.cvp
This keyboard application was the best.
But there is a problem.
When you enter the emoji of the iPhone, it doesn't move to the end of the sentence when you move the cursor with the end button.The cursor stops before two letters, and it doesn't move even when I press the right button.
If I don't use emoji, it works properly, so I think the emoji is the cause, but I don't know how to solve it.
If you change the line with Emoji, Emoji will also disappear.
Is this a bug?
-
@shinya.ta The reason is that emoji count as 2 characters and the objectivec positionFromPosition_offset_ is not working correctly with these characters.
You can even have some crashes of your app.
I don't know how to solve that but I'll search.
Temporary, you can press multiple times the left or right key. -
Should I?
It always occurs when emoji are used.
Is there a solution?