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.


    Horizonally Scrolling TextView

    Pythonista
    ui module pythonista ui.textview ui.view
    4
    6
    6424
    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.
    • user
      user last edited by

      Is it possible to create a TextView that Will scroll from left to right in the Ui module? It seems there is no way to prevent the text wrapping.

      I've tried wrapping the TextView within a ScrollView and allowing the TextView to scale to its contents, but it never seemed to work, and I've been unable to find examples of either within the documentation.

      1 Reply Last reply Reply Quote 0
      • ccc
        ccc last edited by ccc

        Do you have some minimal implementation code that we can stare at? In general, you need to make sure that the width of the ScrollView frame is larger than the width of the TextView frame.

        1 Reply Last reply Reply Quote 0
        • Webmaster4o
          Webmaster4o last edited by

          @ccc I don't think he's trying to get a TextView to move around within a scroll view. I think he's trying to imitate the default vertical-scrolling behavior of a TextView, only horizontally.

          1 Reply Last reply Reply Quote 0
          • ccc
            ccc last edited by

            https://github.com/cclauss/Ten-lines-or-less/blob/master/scroll_horizontally.py

            1 Reply Last reply Reply Quote 1
            • user
              user last edited by

              # coding: utf-8
              import ui
              
              v=ui.load_view('ScriptUIBehaviorTest')
              outText=('*'*5000 + '\n') * 3
              
              v['scrollview1'].border_width=3
              v['scrollview1'].height=378
              v['scrollview1'].width=378
              
              tView = v['scrollview1']['textview1']
              tView.text = outText
              tView.width=10000
              
              v.present()
              

              I created a scrollview with a textview inside in the UI editor.

              Rather than the text in the TextView extending past the scrollview borders and being able to scroll sideways, it simply wraps around at the borders of the scrollview.

              1 Reply Last reply Reply Quote 0
              • JonB
                JonB last edited by JonB

                Did you look at ccc's link? He shows how to set content size of the scrollview, and width of the textview. The key is that you are creating a textview wider than the scrollview width, and the scrollview content_width also must be wider than the scrollview width.

                1 Reply Last reply Reply Quote 0
                • First post
                  Last post
                Powered by NodeBB Forums | Contributors