omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular

    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.


    Keyboard ui button.

    Pythonista
    2
    55
    23683
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • shinya.ta
      shinya.ta @cvp last edited by

      @cvp

      Dear.cvp

      When I tried the program, I got a Syntaxerror. Why is that?

      cvp 1 Reply Last reply Reply Quote 0
      • cvp
        cvp @shinya.ta last edited by

        @shinya.ta If the syntax error comes from the last line, I had made a copy/paste error, please check the two last lines versus the edit script above

        shinya.ta 2 Replies Last reply Reply Quote 0
        • shinya.ta
          shinya.ta @cvp last edited by

          @cvp

          Dear.cvp

          I tried it, but iPad can show next emji, but I couldn't display it on iPhone.

          1 Reply Last reply Reply Quote 0
          • shinya.ta
            shinya.ta @cvp last edited by

            @cvp

            I would like to display multiple windows at the same time and edit the text.

            Can I make it with Pythonisa?

            I don't know how to send pictures here.
            If you see the picture, I think you can see the image.

            cvp 2 Replies Last reply Reply Quote 0
            • cvp
              cvp @shinya.ta last edited by

              @shinya.ta To post here a picture, I use this little script:

              import pyimgur,photos,clipboard,os,console
              i=photos.pick_image()
              if i:
              	print(i.format)
              	format = 'gif' if (i.format == 'GIF') else 'jpg'
              	i.save('img.'+format)
              	clipboard.set(pyimgur.Imgur("303d632d723a549").upload_image('img.'+format, title="Uploaded-Image").link)
              	console.hud_alert("link copied!")
              	os.remove('img.'+format)
              

              You have to

              • run this script
              • the program will ask you to pick a picture from your camera roll
              • the program sends the picture to imgur site and copy the url in the clipboard
              • here, in the forum, you paste this url from the clipboard in a post
              • that's all, it takes some seconds
              1 Reply Last reply Reply Quote 1
              • cvp
                cvp @shinya.ta last edited by cvp

                @shinya.ta If the 'next emoji' is not displayed on iPhone, it is perhaps a problem of screen width (sorry, I can't test it), you could try to put a shorter title to this button, like

                UIBarButtonItem = ObjCClass('UIBarButtonItem').alloc().initWithTitle_style_target_action_('⏩',0,bb_target,sel('invokeAction:')).autorelease()
                

                If you parametrized big characters in your iPhone settings, the system does not have sufficient room to display this button

                shinya.ta 1 Reply Last reply Reply Quote 0
                • shinya.ta
                  shinya.ta @cvp last edited by

                  @cvp

                  It was difficult to send a photo to me because it was difficult to send.
                  So, I will explain in writing.

                  Can I open multiple windows at the same time with Pythonisa so that I can open multiple tasks with a computer?

                  cvp 3 Replies Last reply Reply Quote 0
                  • cvp
                    cvp @shinya.ta last edited by

                    @shinya.ta you can run multiple threads to process several tasks at once but you will have only one UI, user interface, thus not really multiple windows active at the same time.

                    1 Reply Last reply Reply Quote 0
                    • cvp
                      cvp @shinya.ta last edited by cvp

                      @shinya.ta Apple's doc says:

                      Custom items can be added to the shortcuts bar on iPad only. On iPhone, the contents of the UITextInputAssistantItem object are ignored.

                      here

                      1 Reply Last reply Reply Quote 0
                      • cvp
                        cvp @shinya.ta last edited by

                        @shinya.ta You can find a version running on iPhone and iPad here

                        shinya.ta 1 Reply Last reply Reply Quote 0
                        • shinya.ta
                          shinya.ta @cvp last edited by

                          @cvp

                          I see, I'll try to open it on GitHub.

                          cvp 1 Reply Last reply Reply Quote 0
                          • cvp
                            cvp @shinya.ta last edited by

                            @shinya.ta you can always

                            • tap raw
                            • select all
                            • copy
                            • paste it into your (new) script in Pythonista
                            shinya.ta 1 Reply Last reply Reply Quote 0
                            • shinya.ta
                              shinya.ta @cvp last edited by

                              @cvp

                              Thank you. I'll try it on the weekend.

                              You are God.

                              cvp 1 Reply Last reply Reply Quote 0
                              • cvp
                                cvp @shinya.ta last edited by

                                @shinya.ta Try it before saying that, you'll perhaps regret it 😇

                                shinya.ta 2 Replies Last reply Reply Quote 0
                                • shinya.ta
                                  shinya.ta @cvp last edited by

                                  @cvp

                                  I am not sure if it is related to this program, but if you use voiceover on Pythonisa, there will be a sound that is irrelevant to the prediction conversion.

                                  Why is this?

                                  cvp 1 Reply Last reply Reply Quote 0
                                  • cvp
                                    cvp @shinya.ta last edited by

                                    @shinya.ta I'm really sorry but I don't understand your post.
                                    First of all, if your problem occurs when you start Pythonista, even outside my script, please try to describe with a maximum of details the problem in a new topic,assuming it is a Pythonista bug, thus for @omz
                                    If the problem occurs only in my script, stay in this topic but give, please , more info's.

                                    shinya.ta 1 Reply Last reply Reply Quote 0
                                    • shinya.ta
                                      shinya.ta @cvp last edited by

                                      @cvp

                                      The same thing happened in the script on GitHub.

                                      Is it better to make a topic with another topic?

                                      cvp 1 Reply Last reply Reply Quote 0
                                      • cvp
                                        cvp @shinya.ta last edited by

                                        @shinya.ta Ok, try first in this topic, but, please, give a maximum infos about the problem

                                        shinya.ta 2 Replies Last reply Reply Quote 0
                                        • shinya.ta
                                          shinya.ta @cvp last edited by

                                          @cvp

                                          Dear.cvp

                                          I tried the spractin.
                                          I was able to do it well both on iPhone and iPad.

                                          Thank you very much.

                                          1 Reply Last reply Reply Quote 0
                                          • shinya.ta
                                            shinya.ta @cvp last edited by

                                            @cvp

                                            I'm a little greedy, but is it possible to use the following programs mixed?

                                            import ui
                                            from objc_util import *
                                            
                                            def NextFieldKeyInTextFieldKeyboard(view, button, background_color='lightgray'):
                                                # parameters: view = main view of textfields
                                                #                           button = ui.Button designed by user (size, title, image...)
                                                #                           background_color = background_color of InputAccessoryView
                                                # create ui.View for InputAccessoryView above keyboard
                                                v = ui.View()                                                   # view above keyboard
                                                v.background_color = background_color   # background_color of user choice
                                                v.width = ui.get_screen_size()[0]           # width of screen, thus of keyboard
                                                v.height = button.height + 4                    # only for Next button
                                            
                                                # code executed when Next key is tapped
                                                def Next_tapped(sender):
                                                    s = sender.objc_instance.firstResponder()._nextKeyResponder().becomeFirstResponder()    
                                                button.action = Next_tapped                     # code to be executed if button tapped
                                                v.add_subview(button)                                   # set as subview of view
                                                
                                                vo = ObjCInstance(v)                                    # get ObjectiveC object of v
                                                # attach to each textfield an InputAccessoryView abobe the keyboard
                                                for sv in view.subviews:                            # loop on all subviews of main view
                                                    if 'TextField' in str(type(sv)):        # subview is a TextField
                                                        tfo = ObjCInstance(sv).textField()# get ObjectiveC object of sv
                                                        tfo.setInputAccessoryView_(vo)      # attach our accessory to textfield
                                                    
                                            if __name__ == '__main__':
                                                main_view = ui.View()
                                                main_view.name = 'NextFieldKeyInTextFieldKeyboard'
                                                main_view.frame = (0,0,380,140)
                                                main_view.add_subview(ui.TextField(frame=(10,  2,360,32)))
                                                main_view.add_subview(ui.TextField(frame=(10, 36,360,32)))
                                                main_view.add_subview(ui.TextField(frame=(10, 70,360,32)))
                                                main_view.add_subview(ui.TextField(frame=(10,104,360,32)))
                                                button = ui.Button()                                # Button for Next key
                                                button.frame = (0,0,32,32)
                                                button.font = ('<System-Bold>',24)
                                                button.title = '⏯'                                  #  emoji as title
                                                NextFieldKeyInTextFieldKeyboard(main_view,button)#,background_color='green')
                                                main_view.present('sheet')
                                            
                                            1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post
                                            Powered by NodeBB Forums | Contributors