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 you want to limit the number of lines of the TextView to 1, use this
tv = ui.TextView() ObjCInstance(tv).textContainer().maximumNumberOfLines = 1
And so, your code main remain unchanged, but you don't need the up and down buttons
-
-
@shinya.ta Sorry for the delay, lunch time here
Your question falls outside Pythonista
But ok- settings
- general
- keyboard
- keyboards
- add a keyboard
-
I'm sorry, too.
I know that setting, but don't I need to switch the keyboard switch button after setting pythonisa application?
-
@shinya.ta Normally, if you have defined several keyboards in settings, you should se the globe key when you try to type in the textfield, don't you?
-
I'm Japanese, so I use the switch button when I use English switching or emoji.
-
@shinya.ta I understand, I'm from Belgium, I use this globe button when I need to switch French-Dutch-English-emoji but I use the button in the iOS keyboard
-
I want to switch this application to a switch button, like English and Japanese.
-
@shinya.ta If you want an ui.Button like the other ones to switch language, I think it isn't possible.
Why not use globe key of the iOS keyboard? -
Can I do that button?
Textview does not read text in VoiceOver for one word.
TextField reads each word in voice.
We need to remake it with TextField.Where do I need to rewrite?
-
@shinya.ta I'll do it, let me some time😢
-
-
@shinya.ta with TextField, but with "my" ranges
import ui from objc_util import * v = ui.View() v.frame = (0,0,500,370) v.name = 'Move cursor in TextField' tv = ui.TextField() tv.name = 'TextField' tv.frame = (120,10,370,64) tv.font = ('Arial Rounded MT Bold',24) tv.text = 'this is the sentence' v.add_subview(tv) b_top = ui.Button() b_top.frame = (10,10,100,32) b_top.title = 'begin' b_top.background_color = 'white' b_top.border_width = 1 def b_top_action(sender): tv = sender.superview['TextField'] tvo = ObjCInstance(tv).textField() # set cursor cursor_position = tvo.positionFromPosition_offset_(tvo.beginningOfDocument(), 0) tvo.selectedTextRange = tvo.textRangeFromPosition_toPosition_(cursor_position, cursor_position) b_top.action = b_top_action v.add_subview(b_top) b_left = ui.Button() b_left.frame = (10,50,100,32) b_left.title = 'left' b_left.background_color = 'white' b_left.border_width = 1 def b_left_action(sender): tv = sender.superview['TextField'] tvo = ObjCInstance(tv).textField() i = tvo.offsetFromPosition_toPosition_(tvo.beginningOfDocument(), tvo.selectedTextRange().start()) i = i - 1 if i < 0: i = 0 cursor_position = tvo.positionFromPosition_offset_(tvo.beginningOfDocument(), i) tvo.selectedTextRange = tvo.textRangeFromPosition_toPosition_(cursor_position, cursor_position) b_left.action = b_left_action v.add_subview(b_left) b_right = ui.Button() b_right.frame = (10,90,100,32) b_right.title = 'right' b_right.background_color = 'white' b_right.border_width = 1 def b_right_action(sender): tv = sender.superview['TextField'] tvo = ObjCInstance(tv).textField() i = tvo.offsetFromPosition_toPosition_(tvo.beginningOfDocument(), tvo.selectedTextRange().start()) i = i + 1 l = len(tv.text) if i > l: i = l cursor_position = tvo.positionFromPosition_offset_(tvo.beginningOfDocument(), i) tvo.selectedTextRange = tvo.textRangeFromPosition_toPosition_(cursor_position, cursor_position) b_right.action = b_right_action v.add_subview(b_right) b_bottom = ui.Button() b_bottom.frame = (10,130,100,32) b_bottom.title = 'end' b_bottom.background_color = 'white' b_bottom.border_width = 1 def b_bottom_action(sender): tv = sender.superview['TextField'] tvo = ObjCInstance(tv).textField() i = len(tv.text) cursor_position = tvo.positionFromPosition_offset_(tvo.beginningOfDocument(), i) tvo.selectedTextRange = tvo.textRangeFromPosition_toPosition_(cursor_position, cursor_position) b_bottom.action = b_bottom_action v.add_subview(b_bottom) b_del = ui.Button() b_del.frame = (10,170,100,32) b_del.title = 'del' b_del.background_color = 'white' b_del.border_width = 1 def b_del_action(sender): tv = sender.superview['TextField'] tvo = ObjCInstance(tv).textField() i = tvo.offsetFromPosition_toPosition_(tvo.beginningOfDocument(), tvo.selectedTextRange().start()) if i < len(tv.text): tv.text = tv.text[:i] + tv.text[i+1:] cursor_position = tvo.positionFromPosition_offset_(tvo.beginningOfDocument(), i) tvo.selectedTextRange = tvo.textRangeFromPosition_toPosition_(cursor_position, cursor_position) b_del.action = b_del_action v.add_subview(b_del) b_clear = ui.Button() b_clear.frame = (10,210,100,32) b_clear.title = 'clear' #b_clear.frame = (tv.x+tv.width-32,tv.y+tv.height+5,32,32) #b_clear.corner_radius = 16 #b_clear.title = '✖️' b_clear.background_color = 'white' b_clear.border_width = 1 def b_clear_action(sender): tv = sender.superview['TextField'] tv.text = '' b_clear.action = b_clear_action v.add_subview(b_clear) v.present('sheet') tv.selected_range = (0,0) tv.begin_editing()```
-
Dear.cvp
Thank you, but there was a problem.
Font or Textfield is the cause and does not read aloud the word.
The previous number app was read in one word character.
I'm not sure what's wrong.
-
@shinya.ta One more time sorry but I really don't understand what you mean to say
-
@shinya.ta if you want that the script reads your text, try
import speech b_speech = ui.Button() b_speech.frame = (10,250,100,32) b_speech.title = 'speech' b_speech.background_color = 'white' b_speech.border_width = 1 def b_speech_action(sender): tv = sender.superview['TextField'] #print(speech.get_synthesis_languages()) speech.say(tv.text,'en-US') #speech.say(tv.text,'ja-JP') b_speech.action = b_speech_action v.add_subview(b_speech)```
-
-
@shinya.ta French butEnglish is good
-
@shinya.ta if you want it reads one character at the time
for c in tv.text: speech.say(c,'en-US') # or other language
But that is not VoiceOver but the speech module of Pythonista
-
Dans le programme précédent, un message d'erreur était émis.