ScrolledText?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • nik

    #1

    ScrolledText?

    I've been trying to get the scrollbar and text box always going to the
    last line and have been completely unsuccessful.

    I've tried, ScrolledText, text.see, and text.yview_pick place without
    success

    for instance this was the last setup:

    self.text = ScrolledText(ma ster, relief=RIDGE)
    self.text.grid( column=1, row=2, columnspan=10,\
    rowspan=5, pady=10, sticky=NSEW)

    with this text entry:

    self.text.inser t(END, ins)
    self.text.yview _pickplace("end ")

    Can anybody please tell me what I might be doing wrong, or an example
    that works, so that I can see what's going wrong.

    Thanks,
    Nik

  • Basilisk96

    #2
    Re: ScrolledText?

    Would this work?

    self.text = wx.TextCtrl(pan el, style=wx.TE_MUL TILINE)
    ....
    line = '\n' + "Hello world!"
    self.text.Appen dText(line)

    Comment

    • nik

      #3
      Re: ScrolledText?

      Thank you, but I am not sure.
      What is wx in this case?

      I should have mentioned that I am using Tkinter, am pretty new to
      python
      and had previously tried just a plain text box with a scrollbar
      without success.
      The scrollbar always works manually, nothing I've tried yet has
      scrolled down automatically.

      Thanks

      Comment

      • Basilisk96

        #4
        Re: ScrolledText?

        Ah.. wx is wxPython in this case, a GUI toolkit like Tkinter, but
        based on wxWidgets.
        I don't know if Tk has a text control with a method similar to the
        AppendText method I showed here.. I used to have the exact same
        problem as you until I discovered that AppendText always kept the text
        box scrolled at the bottom :)

        How about this:
        >>>help(Tkinter .Text.see)
        Help on method see in module Tkinter:

        see(self, index) unbound Tkinter.Text method
        Scroll such that the character at INDEX is visible.

        It may be what you're looking for if you use 'end' for index ...?

        -Basilisk96

        Comment

        • half.italian@gmail.com

          #5
          Re: ScrolledText?

          On May 1, 3:12 pm, nik <nikb...@gmail. comwrote:
          I've been trying to get the scrollbar and text box always going to the
          last line and have been completely unsuccessful.
          >
          I've tried, ScrolledText, text.see, and text.yview_pick place without
          success
          >
          for instance this was the last setup:
          >
          self.text = ScrolledText(ma ster, relief=RIDGE)
          self.text.grid( column=1, row=2, columnspan=10,\
          rowspan=5, pady=10, sticky=NSEW)
          >
          with this text entry:
          >
          self.text.inser t(END, ins)
          self.text.yview _pickplace("end ")
          >
          Can anybody please tell me what I might be doing wrong, or an example
          that works, so that I can see what's going wrong.
          >
          Thanks,
          Nik
          try...

          self.text.yview _moveto(1)

          ~Sean

          Comment

          • nik

            #6
            Re: ScrolledText?

            Great thank you for the help, we got it working.

            Comment

            Working...